From af9f78852a9418d613f0ca29e20ca19fef413dde Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Nov 2017 13:50:47 +0100 Subject: [PATCH] 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. --- tests/archive/archivetest.cpp | 18 ++++++++++-------- tests/archive/archivetest.h | 2 +- tests/archive/tartest.cpp | 3 ++- tests/archive/ziptest.cpp | 22 ++-------------------- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/tests/archive/archivetest.cpp b/tests/archive/archivetest.cpp index 7742b0caeb..220fd46b4e 100644 --- a/tests/archive/archivetest.cpp +++ b/tests/archive/archivetest.cpp @@ -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( diff --git a/tests/archive/archivetest.h b/tests/archive/archivetest.h index 8e77edff84..91f053c675 100644 --- a/tests/archive/archivetest.h +++ b/tests/archive/archivetest.h @@ -249,7 +249,7 @@ public: ArchiveTestSuite(std::string name); protected: - virtual ArchiveTestSuite *makeSuite(); + void DoRunTest(); virtual CppUnit::Test *makeTest(std::string descr, int options, diff --git a/tests/archive/tartest.cpp b/tests/archive/tartest.cpp index b563ff57f7..07d907a538 100644 --- a/tests/archive/tartest.cpp +++ b/tests/archive/tartest.cpp @@ -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, diff --git a/tests/archive/ziptest.cpp b/tests/archive/ziptest.cpp index cfd68ff091..ab1809460a 100644 --- a/tests/archive/ziptest.cpp +++ b/tests/archive/ziptest.cpp @@ -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,