[Libreoffice-commits] online.git: loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat Mar 26 16:57:16 UTC 2016


 loolwsd/test/test.cpp |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 0f580476fc1e018664bf120d80ef9583349b7dda
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Mar 25 19:41:53 2016 -0400

    loolwsd: improving unittests
    
    Dumping of registered tests in preparation
    to allow for selective test running.
    
    Change-Id: I83af1c9be211804f757918c326602a0b53815704
    Reviewed-on: https://gerrit.libreoffice.org/23531
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/test.cpp b/loolwsd/test/test.cpp
index 96a071e..ced03e0 100644
--- a/loolwsd/test/test.cpp
+++ b/loolwsd/test/test.cpp
@@ -11,20 +11,41 @@
 #include <cppunit/TestRunner.h>
 #include <cppunit/TestResult.h>
 #include <cppunit/TestResultCollector.h>
+#include <cppunit/TextTestProgressListener.h>
 #include <cppunit/BriefTestProgressListener.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/CompilerOutputter.h>
 
-int main()
+/// Dump all the tests registered.
+void dumpTests(CPPUNIT_NS::Test* test)
+{
+    if (test != nullptr)
+    {
+        std::cout << test->getName() << std::endl;
+        if (test->getChildTestCount())
+        {
+            for (auto i = 0; i < test->getChildTestCount(); ++i)
+            {
+                dumpTests(test->getChildTestAt(i));
+            }
+        }
+    }
+}
+
+int main(int /*argc*/, char** /*argv*/)
 {
     CPPUNIT_NS::TestResult controller;
     CPPUNIT_NS::TestResultCollector result;
     controller.addListener(&result);
     CPPUNIT_NS::BriefTestProgressListener progress;
     controller.addListener(&progress);
+    controller.addListener(new CPPUNIT_NS::TextTestProgressListener());
+
+    auto all = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
+    //dumpTests(all);
 
     CPPUNIT_NS::TestRunner runner;
-    runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
+    runner.addTest(all);
     runner.run(controller);
 
     CPPUNIT_NS::CompilerOutputter outputter(&result, std::cerr);


More information about the Libreoffice-commits mailing list