aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-31 01:46:18 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-12-31 01:46:18 +0000
commitcd3547c0f5b90976f207159c733598254730f019 (patch)
treea9560d9c7d1adb6a85c0608d4311a64cef0b9100
parent4669066e4c709fce6728d2cb6758b00288bf8c2f (diff)
downloadpaludis-cd3547c0f5b90976f207159c733598254730f019.tar.gz
paludis-cd3547c0f5b90976f207159c733598254730f019.tar.xz
NAMED_TEST_ONLY hack
-rw-r--r--test/test_framework.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/test_framework.cc b/test/test_framework.cc
index 2d80e0b..752fb02 100644
--- a/test/test_framework.cc
+++ b/test/test_framework.cc
@@ -226,10 +226,12 @@ class RunTest
{
private:
bool * const _had_a_failure;
+ const std::string _named_test;
public:
- RunTest(bool * had_a_failure) :
- _had_a_failure(had_a_failure)
+ RunTest(bool * had_a_failure, const std::string & named_test) :
+ _had_a_failure(had_a_failure),
+ _named_test(named_test)
{
}
@@ -241,6 +243,12 @@ RunTest::operator() (TestCase * test_case) const
{
bool had_local_failure(false);
+ if ((! _named_test.empty()) && (_named_test != test_case->name()))
+ {
+ std::cout << "* \"" << test_case->name() << "\": (skip due to NAMED_TEST_ONLY)" << std::endl;
+ return;
+ }
+
std::cout << "* \"" << test_case->name() << "\": " << std::flush;
for (int repeat = 0 ; repeat < 2 ; ++repeat)
@@ -301,10 +309,14 @@ TestCaseList::run_tests()
{
bool had_a_failure(get_test_case_list()->empty());
+ std::string named_test;
+ if (getenv("NAMED_TEST_ONLY"))
+ named_test = getenv("NAMED_TEST_ONLY");
+
std::for_each(
get_test_case_list()->begin(),
get_test_case_list()->end(),
- RunTest(&had_a_failure));
+ RunTest(&had_a_failure, named_test));
return ! had_a_failure;
}