mirror of
https://github.com/catchorg/Catch2.git
synced 2025-05-25 05:59:24 +00:00
Tags beginning with a non alpha-numeric character are now disallowed.
Added !throws special tag which denotes a test case to be skipped when run with -e (the idea being that the test case is expected to throw an exception which is not caught within a XXX_THROWS assertion).
This commit is contained in:
parent
c5406a25bf
commit
20cad7cb1d
18 changed files with 312 additions and 244 deletions
|
@ -41,9 +41,12 @@ namespace Catch {
|
|||
}
|
||||
else {
|
||||
TestCase const& prev = *m_functions.find( testCase );
|
||||
std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n"
|
||||
<< "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n"
|
||||
<< "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl;
|
||||
{
|
||||
Colour colourGuard( Colour::Red );
|
||||
std::cerr << "error: TEST_CASE( \"" << name << "\" ) already defined.\n"
|
||||
<< "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n"
|
||||
<< "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -56,32 +59,24 @@ namespace Catch {
|
|||
return m_nonHiddenFunctions;
|
||||
}
|
||||
|
||||
// !TBD deprecated
|
||||
virtual std::vector<TestCase> getMatchingTestCases( std::string const& rawTestSpec ) const {
|
||||
std::vector<TestCase> matchingTests;
|
||||
getMatchingTestCases( rawTestSpec, matchingTests );
|
||||
return matchingTests;
|
||||
}
|
||||
|
||||
// !TBD deprecated
|
||||
virtual void getMatchingTestCases( std::string const& rawTestSpec, std::vector<TestCase>& matchingTestsOut ) const {
|
||||
TestCaseFilter filter( rawTestSpec );
|
||||
|
||||
std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin();
|
||||
std::vector<TestCase>::const_iterator itEnd = m_functionsInOrder.end();
|
||||
for(; it != itEnd; ++it ) {
|
||||
if( filter.shouldInclude( *it ) ) {
|
||||
matchingTestsOut.push_back( *it );
|
||||
}
|
||||
virtual void getFilteredTests( TestCaseFilters const& filters, IConfig const& config, std::vector<TestCase>& matchingTestCases ) const {
|
||||
for( std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin(),
|
||||
itEnd = m_functionsInOrder.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
if( filters.shouldInclude( *it ) && ( config.allowThrows() || !it->throws() ) )
|
||||
matchingTestCases.push_back( *it );
|
||||
}
|
||||
}
|
||||
virtual void getMatchingTestCases( TestCaseFilters const& filters, std::vector<TestCase>& matchingTestsOut ) const {
|
||||
std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin();
|
||||
std::vector<TestCase>::const_iterator itEnd = m_functionsInOrder.end();
|
||||
// !TBD: replace with algorithm
|
||||
for(; it != itEnd; ++it )
|
||||
if( filters.shouldInclude( *it ) )
|
||||
matchingTestsOut.push_back( *it );
|
||||
virtual void getFilteredTests( IConfig const& config, std::vector<TestCase>& matchingTestCases ) const {
|
||||
if( config.filters().empty() )
|
||||
return getFilteredTests( TestCaseFilters( "empty" ), config, matchingTestCases );
|
||||
|
||||
for( std::vector<TestCaseFilters>::const_iterator it = config.filters().begin(),
|
||||
itEnd = config.filters().end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
getFilteredTests( *it, config, matchingTestCases );
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue