]> git.saurik.com Git - wxWidgets.git/commitdiff
allow to give the testcase name without the final 'TestCase' postfix
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:06:32 +0000 (00:06 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 21 Mar 2009 00:06:32 +0000 (00:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

tests/test.cpp

index 00d746b2f8db510bdd5b72d47d87ae270ac8d598..afc4ad2ab546e746bf25ff38f4fa4950dc6d2de9 100644 (file)
@@ -231,16 +231,23 @@ int TestApp::OnRun()
 {
     CppUnit::TextTestRunner runner;
 
 {
     CppUnit::TextTestRunner runner;
 
-    for (size_t i = 0; i < m_registries.size(); i++) {
-        auto_ptr<Test> test(m_registries[i].empty() ?
+    for (size_t i = 0; i < m_registries.size(); i++)
+    {
+        std::string reg = m_registries[i];
+        if (!reg.empty() && !wxString(reg).EndsWith("TestCase"))
+            reg += "TestCase";
+        // allow the user to specify the name of the testcase "in short form"
+        // (all wx test cases end with TestCase postfix)
+
+        auto_ptr<Test> test(reg.empty() ?
             TestFactoryRegistry::getRegistry().makeTest() :
             TestFactoryRegistry::getRegistry().makeTest() :
-            TestFactoryRegistry::getRegistry(m_registries[i]).makeTest());
+            TestFactoryRegistry::getRegistry(reg).makeTest());
 
         TestSuite *suite = dynamic_cast<TestSuite*>(test.get());
 
         if (suite && suite->countTestCases() == 0)
             wxLogError(_T("No such test suite: %s"),
 
         TestSuite *suite = dynamic_cast<TestSuite*>(test.get());
 
         if (suite && suite->countTestCases() == 0)
             wxLogError(_T("No such test suite: %s"),
-                wxString(m_registries[i].c_str(), wxConvUTF8).c_str());
+                wxString(reg.c_str(), wxConvUTF8).c_str());
         else if (m_list)
             List(test.get());
         else
         else if (m_list)
             List(test.get());
         else