From 62f9438ad3df089da19015d296d0f42507a3bb7c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 25 Nov 2017 12:08:40 +0100 Subject: [PATCH] Rewrite wxPathList unit test without CppUnit-compatible API Simplify the test by using a single function instead of all the machinery inherited from CppUnit. Also provide more information in case of test failure. --- tests/misc/pathlist.cpp | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/tests/misc/pathlist.cpp b/tests/misc/pathlist.cpp index 4a4e2a9c95..c869b63955 100644 --- a/tests/misc/pathlist.cpp +++ b/tests/misc/pathlist.cpp @@ -18,44 +18,18 @@ #include "wx/filefn.h" -// ---------------------------------------------------------------------------- -// test class -// ---------------------------------------------------------------------------- - -class PathListTestCase : public CppUnit::TestCase -{ -public: - PathListTestCase() { } - -private: - CPPUNIT_TEST_SUITE( PathListTestCase ); - CPPUNIT_TEST( FindValidPath ); - CPPUNIT_TEST_SUITE_END(); - - void FindValidPath(); - - wxDECLARE_NO_COPY_CLASS(PathListTestCase); -}; - -// register in the unnamed registry so that these tests are run by default -CPPUNIT_TEST_SUITE_REGISTRATION( PathListTestCase ); - -// also include in its own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( PathListTestCase, "PathListTestCase" ); - -void PathListTestCase::FindValidPath() +TEST_CASE("wxPathList::FindValidPath", "[file][path]") { #ifdef __UNIX__ - #define CMD_IN_PATH wxT("ls") + #define CMD_IN_PATH "ls" #else - #define CMD_IN_PATH wxT("cmd.exe") + #define CMD_IN_PATH "cmd.exe" #endif wxPathList pathlist; pathlist.AddEnvList(wxT("PATH")); wxString path = pathlist.FindValidPath(CMD_IN_PATH); - CPPUNIT_ASSERT( !path.empty() ); + INFO( CMD_IN_PATH " not found in " << wxGetenv("PATH") ); + CHECK( !path.empty() ); } - -