Fix archivers test suite broken by transition to Catch

The code of ziptest and tartest classes still compiled, but actually
didn't do anything during the run-time because makeSuite() method was
never called.

Replace this unused method with DoRunTest() and override runTest() in
the test suite classes to actually run the tests.
This commit is contained in:
Vadim Zeitlin 2017-11-07 13:50:47 +01:00
parent 5195e788d4
commit af9f78852a
4 changed files with 15 additions and 30 deletions

View File

@ -1185,10 +1185,10 @@ public:
m_options(options)
{ }
protected:
// the entry point for the test
void runTest();
void runTest() wxOVERRIDE;
protected:
void CreateArchive(wxOutputStream& out);
void ExtractArchive(wxInputStream& in);
@ -1299,9 +1299,9 @@ bool ArchiveTestSuite::IsInPath(const wxString& cmd)
return !m_path.FindValidPath(c).empty();
}
// make the test suite
// run all the tests in the test suite
//
ArchiveTestSuite *ArchiveTestSuite::makeSuite()
void ArchiveTestSuite::DoRunTest()
{
typedef wxArrayString::iterator Iter;
@ -1324,7 +1324,10 @@ ArchiveTestSuite *ArchiveTestSuite::makeSuite()
generic != 0, *j, *i);
if (test)
addTest(test);
{
test->runTest();
delete test;
}
}
for (int options = 0; options <= PipeIn; options += PipeIn)
@ -1340,11 +1343,10 @@ ArchiveTestSuite *ArchiveTestSuite::makeSuite()
if (options)
descr += " (PipeIn)";
addTest(new CorruptionTestCase(descr, factory, options));
CorruptionTestCase test(descr, factory, options);
test.runTest();
}
}
return this;
}
CppUnit::Test *ArchiveTestSuite::makeTest(

View File

@ -249,7 +249,7 @@ public:
ArchiveTestSuite(std::string name);
protected:
virtual ArchiveTestSuite *makeSuite();
void DoRunTest();
virtual CppUnit::Test *makeTest(std::string descr,
int options,

View File

@ -31,7 +31,8 @@ class tartest : public ArchiveTestSuite
{
public:
tartest();
static CppUnit::Test *suite() { return (new tartest)->makeSuite(); }
void runTest() wxOVERRIDE { DoRunTest(); }
protected:
CppUnit::Test *makeTest(string descr, int options,

View File

@ -213,11 +213,10 @@ class ziptest : public ArchiveTestSuite
{
public:
ziptest();
static CppUnit::Test *suite() { return (new ziptest)->makeSuite(); }
void runTest() wxOVERRIDE { DoRunTest(); }
protected:
ArchiveTestSuite *makeSuite();
CppUnit::Test *makeTest(string descr, int options,
bool genericInterface, const wxString& archiver,
const wxString& unarchiver);
@ -230,23 +229,6 @@ ziptest::ziptest()
AddUnArchiver(wxT("unzip -q %s"));
}
ArchiveTestSuite *ziptest::makeSuite()
{
ArchiveTestSuite::makeSuite();
#if 0
// zip doesn't support this any more so disabled
if (IsInPath(wxT("zip")))
for (int options = 0; options <= PipeIn; options += PipeIn) {
string name = Description(wxT("ZipPipeTestCase"), options,
false, wxT(""), wxT("zip -q - -"));
addTest(new ZipPipeTestCase(name, options));
}
#endif
return this;
}
CppUnit::Test *ziptest::makeTest(
string descr,
int options,