Page MenuHomeWildfire Games

Fix newlines of test assertion failures
ClosedPublic

Authored by elexis on Oct 7 2017, 8:54 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP20292: Fix string format of the JS test assertion failure following r7259 (cxxtest…
Trac Tickets
#4807
Summary

As reported in #4807, if we have a test assertion failure, we get \n printed as characters instead of actual newlines, making stacktraces and error messages ugly to read.
r3974 was the commit to introduced cxxtest. It was version 3.10.1 (2004-12-01), see https://trac.wildfiregames.com/browser/ps/trunk/libraries/cxxtest/Versions?rev=3974

cxxtest's TS_FAIL method requires a const char *message.
That is true since its introduction (see https://trac.wildfiregames.com/browser/ps/trunk/libraries/cxxtest/include/cxxtest/TestSuite.h?rev=3974#L41)
and for the most recent version 4.4 added in r15667 (see https://trac.wildfiregames.com/browser/ps/trunk/libraries/source/cxxtest-4.4/cxxtest/TestSuite.h#L58).

r7259 introduced script_TS_FAIL(void*, std::wstring msg) calling TS_FAIL(msg). The missing conversion from std::wstring to char* results in the mentioned newline error and can be fixed by just adding the conversion.

Test Plan

Change any number in the JS component tests to trigger an assertion and see the broken / fixed newlines.
Trust, remember previous success of utf8_from_wstring use or test on Windows and possibly test platforms other than my Ubuntu.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Oct 7 2017, 8:54 PM
elexis added a reviewer: Restricted Owners Package.Oct 7 2017, 8:55 PM
Vulcan added a subscriber: Vulcan.Oct 7 2017, 8:58 PM

Build is green

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (307 tests)...................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jenkins-master:8080/job/phabricator/2106/ for more details.

Vulcan added a comment.Oct 7 2017, 8:58 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...

http://jenkins-master:8080/job/phabricator_lint/579/ for more details.

This revision was automatically updated to reflect the committed changes.