mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-20 22:31:31 +02:00
cppunit: update from 1.4.2 & vs 2010 project
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "WinTestRunner/WinTestRunner.h"
|
||||
#include "TestRunnerDlg.h"
|
||||
#include "CppUnit/TestRunner.h"
|
||||
#include <fstream>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
@@ -26,17 +28,47 @@ WinTestRunner::~WinTestRunner()
|
||||
|
||||
void WinTestRunner::run()
|
||||
{
|
||||
TestRunnerDlg dlg;
|
||||
|
||||
dlg.setTests(_tests);
|
||||
dlg.DoModal();
|
||||
// Note: The following code is some evil hack to
|
||||
// add batch capability to the MFC based WinTestRunner.
|
||||
|
||||
std::string cmdLine(AfxGetApp()->m_lpCmdLine);
|
||||
if (cmdLine.size() >= 2 && cmdLine[0] == '/' && (cmdLine[1] == 'b' || cmdLine[1] == 'B'))
|
||||
{
|
||||
// We're running in batch mode.
|
||||
std::string outPath;
|
||||
if (cmdLine.size() > 4 && cmdLine[2] == ':')
|
||||
outPath = cmdLine.substr(3);
|
||||
else
|
||||
outPath = "CON";
|
||||
std::ofstream ostr(outPath.c_str());
|
||||
if (ostr.good())
|
||||
{
|
||||
TestRunner runner(ostr);
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
runner.addTest((*it)->toString(), *it);
|
||||
_tests.clear();
|
||||
std::vector<std::string> args;
|
||||
args.push_back("WinTestRunner");
|
||||
args.push_back("-all");
|
||||
bool success = runner.run(args);
|
||||
ExitProcess(success ? 0 : 1);
|
||||
}
|
||||
else ExitProcess(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're running in interactive mode.
|
||||
TestRunnerDlg dlg;
|
||||
dlg.setTests(_tests);
|
||||
dlg.DoModal();
|
||||
}
|
||||
dlg.setTests(_tests);
|
||||
dlg.DoModal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WinTestRunner::addTest(Test* pTest)
|
||||
{
|
||||
_tests.push_back(pTest);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(WinTestRunnerApp, CWinApp)
|
||||
@@ -44,7 +76,7 @@ END_MESSAGE_MAP()
|
||||
|
||||
|
||||
BOOL WinTestRunnerApp::InitInstance()
|
||||
{
|
||||
{
|
||||
AllocConsole();
|
||||
SetConsoleTitle("CppUnit WinTestRunner Console");
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
|
Reference in New Issue
Block a user