Merge branch 'throw-on-duplicate-tests' of git://github.com/rcdailey/Catch into rcdailey-throw-on-duplicate-tests

This commit is contained in:
Phil Nash 2016-05-10 19:06:47 +01:00
commit b57e734eb4

View File

@ -61,12 +61,14 @@ namespace Catch {
++it ) {
std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it );
if( !prev.second ) {
Catch::cerr()
<< Colour( Colour::Red )
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;
exit(1);
throw std::runtime_error(ss.str());
}
}
}