diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-06-04 11:05:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-06-04 11:05:58 +0200 |
commit | b2725b7d1bd53211a7c432f79a8ab5ab4b6d448f (patch) | |
tree | db23c21ae8fdaf9804dd2bcb6b2d418139e4f5aa /sal/cppunittester | |
parent | 56e071690febd8ee0e4c71684c9ed592fc5a628a (diff) |
Keep TestFixture alive until outputter is done with it
Change-Id: Ifd921efa971f7a9a5c47f42c5d56a3deb1c3a0b3
Diffstat (limited to 'sal/cppunittester')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index 9c58b271b19d..51bc5c68a06e 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -218,38 +218,42 @@ public: } #endif - CppUnit::TestResultCollector collector; - result.addListener(&collector); + for (size_t i = 0; i < protectors.size(); ++i) + result.pushProtector(protectors[i]); + + bool success; + { + CppUnit::TestResultCollector collector; + result.addListener(&collector); - LogFailuresAsTheyHappen logger; - result.addListener(&logger); + LogFailuresAsTheyHappen logger; + result.addListener(&logger); #ifdef TIMETESTS - TimingListener timer; - result.addListener(&timer); + TimingListener timer; + result.addListener(&timer); #endif #ifdef UNX - EyecatcherListener eye; - result.addListener(&eye); + EyecatcherListener eye; + result.addListener(&eye); #endif - for (size_t i = 0; i < protectors.size(); ++i) - result.pushProtector(protectors[i]); - { CppUnit::TestRunner runner; runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest()); runner.run(result); + + CppUnit::CompilerOutputter outputter(&collector, CppUnit::stdCErr()); + outputter.setNoWrap(); + outputter.write(); + success = collector.wasSuccessful(); } for (size_t i = 0; i < protectors.size(); ++i) result.popProtector(); - CppUnit::CompilerOutputter outputter(&collector, CppUnit::stdCErr()); - outputter.setNoWrap(); - outputter.write(); - return collector.wasSuccessful(); + return success; } virtual bool operator()() const SAL_OVERRIDE { |