cppunit: fix WinTestRunner.cpp

This commit is contained in:
Marian Krivos 2011-09-14 13:03:06 +00:00
Родитель ff7f224691
Коммит c13df6f828
1 изменённых файлов: 38 добавлений и 38 удалений

Просмотреть файл

@ -1,7 +1,7 @@
// //
// WinTestRunner.cpp // WinTestRunner.cpp
// //
// $Id: //poco/Main/CppUnit/WinTestRunner/src/WinTestRunner.cpp#6 $ // $Id: //poco/1.4/CppUnit/WinTestRunner/src/WinTestRunner.cpp#1 $
// //
@ -28,47 +28,47 @@ WinTestRunner::~WinTestRunner()
void WinTestRunner::run() void WinTestRunner::run()
{ {
// Note: The following code is some evil hack to // Note: The following code is some evil hack to
// add batch capability to the MFC based WinTestRunner. // add batch capability to the MFC based WinTestRunner.
std::string cmdLine(AfxGetApp()->m_lpCmdLine); std::string cmdLine(AfxGetApp()->m_lpCmdLine);
if (cmdLine.size() >= 2 && cmdLine[0] == '/' && (cmdLine[1] == 'b' || cmdLine[1] == 'B')) if (cmdLine.size() >= 2 && cmdLine[0] == '/' && (cmdLine[1] == 'b' || cmdLine[1] == 'B'))
{ {
// We're running in batch mode. // We're running in batch mode.
std::string outPath; std::string outPath;
if (cmdLine.size() > 4 && cmdLine[2] == ':') if (cmdLine.size() > 4 && cmdLine[2] == ':')
outPath = cmdLine.substr(3); outPath = cmdLine.substr(3);
else else
outPath = "CON"; outPath = "CON";
std::ofstream ostr(outPath.c_str()); std::ofstream ostr(outPath.c_str());
if (ostr.good()) if (ostr.good())
{ {
TestRunner runner(ostr); TestRunner runner(ostr);
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it) for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
runner.addTest((*it)->toString(), *it); runner.addTest((*it)->toString(), *it);
_tests.clear(); _tests.clear();
std::vector<std::string> args; std::vector<std::string> args;
args.push_back("WinTestRunner"); args.push_back("WinTestRunner");
args.push_back("-all"); args.push_back("-all");
bool success = runner.run(args); bool success = runner.run(args);
ExitProcess(success ? 0 : 1); ExitProcess(success ? 0 : 1);
} }
else ExitProcess(2); else ExitProcess(2);
} }
else else
{ {
// We're running in interactive mode. // We're running in interactive mode.
TestRunnerDlg dlg; TestRunnerDlg dlg;
dlg.setTests(_tests); dlg.setTests(_tests);
dlg.DoModal(); dlg.DoModal();
} }
dlg.setTests(_tests);
dlg.DoModal();
}
} }
void WinTestRunner::addTest(Test* pTest) void WinTestRunner::addTest(Test* pTest)
{
_tests.push_back(pTest);
}
BEGIN_MESSAGE_MAP(WinTestRunnerApp, CWinApp) BEGIN_MESSAGE_MAP(WinTestRunnerApp, CWinApp)