summaryrefslogtreecommitdiff
path: root/src/DllPlugInTester/DllPlugInTester.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2004-06-25 09:41:28 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2004-06-25 09:41:28 +0000
commit212df8f138166ed053d63d6d54e1a1290e395ae5 (patch)
treecadc9e6eaca1d184b7a69a8b389214d966c4ffb6 /src/DllPlugInTester/DllPlugInTester.cpp
parentd9353259d7f48a5497e72a257f2a549ba719bc0c (diff)
downloadcppunit-212df8f138166ed053d63d6d54e1a1290e395ae5.tar.gz
Include/cppunit/Portability.
include/cppunit/Portability.h: moved OStringStream alias definition to Portability/Stream.h. User need to define EVC4 to indicate that config-evc4.h should be used. (how to we detect this automatically ?). Notes that this means it might be needed to add #include <string> to some headers since its no longer included by Portability.h. * include/cppunit/Portability/Stream.h: define alias OStringStream, stdCOut(), and OFileStream. If CPPUNIT_NO_STREAM is defined (evc4 config), then provides our own implementation (based on sprintf and fwrite). * include/cppunit/config/config-evc4.h: config file for embedded visual c++ 4. Still need to detect for this platform in Portability.h (currently relying on EVC4 being defined...) * *.[cpp/h]: most source files have been impacted with the following change: #include <iostream> -> #include <cppunit/Portability/Stream.h> std::ostream -> CPPUNIT_NS::OStream std::ofstream -> CPPUNIT_NS::OFileStream std::cout -> CPPUNIT_NS::stdCOut() std::endl -> "\n" Also, code using std::cin as been defined out if CPPUNIT_NO_STREAM was defined. The exact list of impact files can be obtain in CVS using tags: TG_CPPUNIT_NO_STREAM_BEFORE & TG_CPPUNIT_NO_STREAM_AFTER.
Diffstat (limited to 'src/DllPlugInTester/DllPlugInTester.cpp')
-rw-r--r--src/DllPlugInTester/DllPlugInTester.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/DllPlugInTester/DllPlugInTester.cpp b/src/DllPlugInTester/DllPlugInTester.cpp
index f1125d8..d43958d 100644
--- a/src/DllPlugInTester/DllPlugInTester.cpp
+++ b/src/DllPlugInTester/DllPlugInTester.cpp
@@ -12,8 +12,7 @@
#include <cppunit/plugin/PlugInParameters.h>
#include <cppunit/plugin/PlugInManager.h>
#include <cppunit/plugin/TestPlugIn.h>
-#include <iostream>
-#include <fstream>
+#include <cppunit/Portability/Stream.h>
#include "CommandLineParser.h"
@@ -43,13 +42,13 @@ runTests( const CommandLineParser &parser )
controller.addListener( &result );
// Set up outputters
- std::ostream *stream = &std::cerr;
+ CPPUNIT_NS::OStream *stream = &CPPUNIT_NS::stdCErr();
if ( parser.useCoutStream() )
- stream = &std::cout;
+ stream = &CPPUNIT_NS::stdCOut();
- std::ostream *xmlStream = stream;
+ CPPUNIT_NS::OStream *xmlStream = stream;
if ( !parser.getXmlFileName().empty() )
- xmlStream = new std::ofstream( parser.getXmlFileName().c_str() );
+ xmlStream = new CPPUNIT_NS::OFileStream( parser.getXmlFileName().c_str() );
CPPUNIT_NS::XmlOutputter xmlOutputter( &result, *xmlStream, parser.getEncoding() );
xmlOutputter.setStyleSheet( parser.getXmlStyleSheet() );
@@ -86,9 +85,9 @@ runTests( const CommandLineParser &parser )
}
catch ( std::invalid_argument & )
{
- std::cerr << "Failed to resolve test path: "
- << parser.getTestPath()
- << std::endl;
+ CPPUNIT_NS::stdCOut() << "Failed to resolve test path: "
+ << parser.getTestPath()
+ << "\n";
}
// Removes plug-in specific TestListener (not really needed but...)
@@ -119,10 +118,9 @@ runTests( const CommandLineParser &parser )
void
printShortUsage( const std::string &applicationName )
{
- std::cout << "Usage:" << std::endl
+ CPPUNIT_NS::stdCOut() << "Usage:\n"
<< applicationName << " [-c -b -n -t -o -w] [-x xml-filename]"
- "[-s stylesheet] [-e encoding] plug-in[=parameters] [plug-in...] [:testPath]"
- << std::endl << std::endl;
+ "[-s stylesheet] [-e encoding] plug-in[=parameters] [plug-in...] [:testPath]\n\n";
}
@@ -130,7 +128,7 @@ void
printUsage( const std::string &applicationName )
{
printShortUsage( applicationName );
- std::cout <<
+ CPPUNIT_NS::stdCOut() <<
"-c --compiler\n"
" Use CompilerOutputter\n"
"-x --xml [filename]\n"
@@ -172,8 +170,7 @@ printUsage( const std::string &applicationName )
"DllPlugInTesterd_dll.exe ClockerPlugInd.dll=\"flat\" -n CppUnitTestPlugInd.dll\n"
"\n"
" Will load the 2 test plug-ins, and pass the parameter string \"flat\"\n"
-"to the Clocker plug-in, disable test progress.\n"
- << std::endl;
+"to the Clocker plug-in, disable test progress.\n\n";
}
@@ -229,8 +226,8 @@ main( int argc,
}
catch ( CommandLineParserException &e )
{
- std::cerr << "Error while parsing command line: " << e.what()
- << std::endl << std::endl;
+ CPPUNIT_NS::stdCOut() << "Error while parsing command line: " << e.what()
+ << "\n\n";
printShortUsage( applicationName );
return badCommadLineReturnCode;
}
@@ -242,15 +239,18 @@ main( int argc,
}
catch ( CPPUNIT_NS::DynamicLibraryManagerException &e )
{
- std::cerr << "Failed to load test plug-in:" << std::endl
- << e.what() << std::endl;
+ CPPUNIT_NS::stdCOut() << "Failed to load test plug-in:\n"
+ << e.what() << "\n";
}
+#if !defined( CPPUNIT_NO_STREAM )
if ( parser.waitBeforeExit() )
{
- std::cout << "Please press <RETURN> to exit" << std::endl;
+ CPPUNIT_NS::stdCOut() << "Please press <RETURN> to exit\n";
+ CPPUNIT_NS::stdCOut().flush();
std::cin.get();
}
+#endif
return wasSuccessful ? successReturnCode : failureReturnCode;
}