diff options
| author | Phil Nash | 2016-05-10 19:06:47 +0100 |
|---|---|---|
| committer | Phil Nash | 2016-05-10 19:06:47 +0100 |
| commit | b57e734eb44c2ac7e6eed660f78df95d83771a23 (patch) | |
| tree | c3ba0bf06a9e574af1c71090ac743404db63c8e4 /include | |
| parent | 5aa2b82b17aeeb935919b1d0bbb93bd0adc86ddb (diff) | |
| parent | 86c0ea2999d1b64af2d1771687567bc4bed2d3f9 (diff) | |
| download | catch3-b57e734eb44c2ac7e6eed660f78df95d83771a23.tar.gz | |
Merge branch 'throw-on-duplicate-tests' of git://github.com/rcdailey/Catch into rcdailey-throw-on-duplicate-tests
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_test_case_registry_impl.hpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/include/internal/catch_test_case_registry_impl.hpp b/include/internal/catch_test_case_registry_impl.hpp index a2b041a3..cc48d917 100644 --- a/include/internal/catch_test_case_registry_impl.hpp +++ b/include/internal/catch_test_case_registry_impl.hpp @@ -60,13 +60,15 @@ namespace Catch { it != itEnd; ++it ) { std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it ); - if( !prev.second ){ - Catch::cerr() - << Colour( Colour::Red ) - << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n" - << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" - << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl; - exit(1); + if( !prev.second ) { + std::ostringstream ss; + + ss << Colour( Colour::Red ) + << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl; + + throw std::runtime_error(ss.str()); } } } |