When using the CompilerOutputter class, how does a developer send the
error messages to the .NET output window?
The following is my main:
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/CompilerOutputter.h>
/// The main() that is used to test.
int main(int argc, char** argv)
{
// if command line contains "-selftest" then this is the post build
check
// => the output must be in the compiler error format.
bool const selfTest = (argc > 1) &&
(std::string("-selftest") == argv[1]);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry =
CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
if( selfTest )
{
CppUnit::CompilerOutputter *outer =
new CppUnit::CompilerOutputter( &runner.result(), std::cerr );
// set the format for the outer
outer->setLocationFormat("%p(%l):" );
// Change the default outputter to a compiler error format
outputter
// The test runner owns the new outputter.
runner.setOutputter( outer );
}
bool const wasSucessful = runner.run( "", !selfTest );
return wasSucessful ? 0 : 1;
}
Should not the std::error be redirected to the Ouput window?
Curt Martin
|