Opened 7 years ago
Closed 7 years ago
#4807 closed defect (fixed)
Test assertion failures print \n instead of newline
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | Core engine | Keywords: | |
Cc: | Patch: | Phab:D952 |
Description
Test failures are reported with "\n" written as characters, instead of displaying them as a line break (at least on my platform).
For example:
../../../source/test_setup.cpp:135: Error: Test failed: L"Stack trace:\nTS_TEST_PERFORMANCE@simulation/components/tests/test_Math.js:146:1\n@simulation/components/tests/test_Math.js:158:1\nFunction is slower than it could be: pow with exponent 2 ran for 3284ms, but the compared function ran only for 4013ms."
That makes it ugly to read the tests and hard to work with these messags.
Any assertion failure has the following stack trace:
TS_FAIL called from test_setup.js, TS_FAIL proxy in source/test_setup.cpp TS_FAIL defined in libraries/source/cxxtest-4.4/cxxtest/TestSuite.h which parses the JS message string with TS_AS_STRING before calling CxxTest::doFailTest
We see that it's either a bug in cxxtest or how we use it.
cxxtest was introduced in r14817, upgraded to 4.4 in r15667 (2014-08-24), which is the most recent version. In particular ValueTraits.cpp
is still the most recent version.
There are now two places where it could be broken:
- Removing the escaping in
charToString
oflibraries/source/cxxtest-4.4/cxxtest/ValueTraits.cpp
which is called fromTS_AS_STRING
removes the reported bug on my platform.
- The pipe it writes to could be used incorrectly.
The escaped string is passed to failedTest
which is defined in libraries/source/cxxtest-4.4/cxxtest/ErrorFormatter.h
, unix.h
and XmlFormatter.h
. TODO: continue looking.
Change History (3)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Milestone: | Backlog → Alpha 23 |
---|---|
Patch: | → Phab:D952 |
Suspected that we might have to pass unix
instead of ErrorPrinter
in configure_cxxtestgen()
of premake4.lua
. But it seems it was just a missing conversion Phab:D952.
You might want to take a look at #2450 that is linked from that revision again ;-)
As for where to look, I suspect you might want to make sure that you actually end up calling the right
asString
, in CxxTest. I suspect theValueTraits<const char * const &>
specialization might not end up being used as we passstd::wstring
to it in the JS-exposedTS_FAIL
.