aboutsummaryrefslogtreecommitdiff
path: root/test/test_framework.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 06:35:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-21 06:35:28 +0000
commit5afcf5c43994dcce339f17a049cb516794043cff (patch)
tree99f5ad8f27b01e343a00f974362c324bf289da67 /test/test_framework.cc
parent268b0c0d806516481023edb3ea60420b68a6e517 (diff)
downloadpaludis-5afcf5c43994dcce339f17a049cb516794043cff.tar.gz
paludis-5afcf5c43994dcce339f17a049cb516794043cff.tar.xz
Coding cleanups, improved -W* goodness
Diffstat (limited to 'test/test_framework.cc')
-rw-r--r--test/test_framework.cc85
1 files changed, 44 insertions, 41 deletions
diff --git a/test/test_framework.cc b/test/test_framework.cc
index a7234fe94..8b60de41a 100644
--- a/test/test_framework.cc
+++ b/test/test_framework.cc
@@ -155,49 +155,52 @@ class RunTest
{
}
- void operator() (TestCase * test_case) const
+ void operator() (TestCase * test_case) const;
+};
+
+void
+RunTest::operator() (TestCase * test_case) const
+{
+ bool had_local_failure(false);
+
+ std::cout << "* \"" << test_case->name() << "\": " << std::flush;
+
+ for (int repeat = 0 ; repeat < 2 ; ++repeat)
+ {
+ if (0 != repeat)
+ std::cout << " (repeat): " << std::flush;
+
+ try
{
- bool had_local_failure(false);
-
- std::cout << "* \"" << test_case->name() << "\": " << std::flush;
-
- for (int repeat = 0 ; repeat < 2 ; ++repeat)
- {
- if (0 != repeat)
- std::cout << " (repeat): " << std::flush;
-
- try
- {
- alarm(test_case->max_run_time());
- test_case->call_run();
- alarm(0);
- }
- catch (std::exception &e)
- {
- std::cout << "!{" << std::endl << exception_to_debug_string(e) <<
- std::endl << " } " << std::flush;
- had_local_failure = true;
- *_had_a_failure = true;
- }
- catch (...)
- {
- std::cout << "!{Unknown exception type} ";
- had_local_failure = true;
- *_had_a_failure = true;
- }
-
- if (had_local_failure)
- std::cout << " NOT OK";
- else
- std::cout << " OK";
-
- std::cout << std::endl;
-
- if (! test_case->repeatable())
- break;
- }
+ alarm(test_case->max_run_time());
+ test_case->call_run();
+ alarm(0);
}
-};
+ catch (std::exception &e)
+ {
+ std::cout << "!{" << std::endl << exception_to_debug_string(e) <<
+ std::endl << " } " << std::flush;
+ had_local_failure = true;
+ *_had_a_failure = true;
+ }
+ catch (...)
+ {
+ std::cout << "!{Unknown exception type} ";
+ had_local_failure = true;
+ *_had_a_failure = true;
+ }
+
+ if (had_local_failure)
+ std::cout << " NOT OK";
+ else
+ std::cout << " OK";
+
+ std::cout << std::endl;
+
+ if (! test_case->repeatable())
+ break;
+ }
+}
bool
TestCaseList::run_tests()