Menu

#138 Unneeded newline printed to std::cout creates invalid XML

1.10.2
open
nobody
5
2005-03-17
2005-03-17
Anonymous
No

If you create a TextTestRunner, and set its output to
an XMLOutputter, you would expect valid (read:
well-formed) XML to be created. However, if you log
the results from your CPPUnit test run to a file, the
file will not be valid XML. This is because in the
TextTestRunner::printResult method, the statement
"std::cout << std::endl;" is executed before the test
output is written, meaning a newline gets inserted
before the XML declaration, meaning you now have
invalid XML.

Removing the "std::cout << std::endl;" statement from
TextTestRunner.cpp's printResult() method will resolve
this issue, and no real functionality will be adversely
affected.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.