mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-30 01:03:30 +01:00
Don't run tests starting with ./ by default. Changed all low-level self tests to be in ./
This commit is contained in:
parent
f36d777343
commit
684baf1053
@ -35,8 +35,8 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
METHOD_AS_TEST_CASE( TestClass::succeedingCase, "succeeding/TestClass/succeedingCase", "A method based test run that succeeds" );
|
METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds" );
|
||||||
METHOD_AS_TEST_CASE( TestClass::failingCase, "failing/TestClass/failingCase", "A method based test run that fails" );
|
METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails" );
|
||||||
|
|
||||||
|
|
||||||
struct Fixture
|
struct Fixture
|
||||||
@ -46,12 +46,12 @@ struct Fixture
|
|||||||
int m_a;
|
int m_a;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_CASE_METHOD( Fixture, "succeeding/Fixture/succeedingCase", "A method based test run that succeeds" )
|
TEST_CASE_METHOD( Fixture, "./succeeding/Fixture/succeedingCase", "A method based test run that succeeds" )
|
||||||
{
|
{
|
||||||
REQUIRE( m_a == 1 );
|
REQUIRE( m_a == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_METHOD( Fixture, "failing/Fixture/failingCase", "A method based test run that fails" )
|
TEST_CASE_METHOD( Fixture, "./failing/Fixture/failingCase", "A method based test run that fails" )
|
||||||
{
|
{
|
||||||
REQUIRE( m_a == 2 );
|
REQUIRE( m_a == 2 );
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ struct TestData
|
|||||||
// This allows us to see all results, even if an earlier check fails
|
// This allows us to see all results, even if an earlier check fails
|
||||||
|
|
||||||
// Equality tests
|
// Equality tests
|
||||||
TEST_CASE( "succeeding/conditions/equality", "Equality checks that should succeed" )
|
TEST_CASE( "./succeeding/conditions/equality", "Equality checks that should succeed" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ TEST_CASE( "succeeding/conditions/equality", "Equality checks that should succee
|
|||||||
REQUIRE( x == Approx( 1.3 ) );
|
REQUIRE( x == Approx( 1.3 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/conditions/equality", "Equality checks that should fail" )
|
TEST_CASE( "./failing/conditions/equality", "Equality checks that should fail" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ TEST_CASE( "failing/conditions/equality", "Equality checks that should fail" )
|
|||||||
CHECK( x == Approx( 1.301 ) );
|
CHECK( x == Approx( 1.301 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/conditions/inequality", "Inequality checks that should succeed" )
|
TEST_CASE( "./succeeding/conditions/inequality", "Inequality checks that should succeed" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ TEST_CASE( "succeeding/conditions/inequality", "Inequality checks that should su
|
|||||||
REQUIRE( data.str_hello.size() != 6 );
|
REQUIRE( data.str_hello.size() != 6 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/conditions/inequality", "Inequality checks that should fails" )
|
TEST_CASE( "./failing/conditions/inequality", "Inequality checks that should fails" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ TEST_CASE( "failing/conditions/inequality", "Inequality checks that should fails
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ordering comparison tests
|
// Ordering comparison tests
|
||||||
TEST_CASE( "succeeding/conditions/ordered", "Ordering comparison checks that should succeed" )
|
TEST_CASE( "./succeeding/conditions/ordered", "Ordering comparison checks that should succeed" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ TEST_CASE( "succeeding/conditions/ordered", "Ordering comparison checks that sho
|
|||||||
REQUIRE( data.str_hello > "a" );
|
REQUIRE( data.str_hello > "a" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/conditions/ordered", "Ordering comparison checks that should fail" )
|
TEST_CASE( "./failing/conditions/ordered", "Ordering comparison checks that should fail" )
|
||||||
{
|
{
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ TEST_CASE( "failing/conditions/ordered", "Ordering comparison checks that should
|
|||||||
// is detected and a warning issued.
|
// is detected and a warning issued.
|
||||||
// An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture
|
// An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture
|
||||||
// the operand value.
|
// the operand value.
|
||||||
TEST_CASE( "succeeding/conditions/not", "'Not' checks that should succeed" )
|
TEST_CASE( "./succeeding/conditions/not", "'Not' checks that should succeed" )
|
||||||
{
|
{
|
||||||
bool falseValue = false;
|
bool falseValue = false;
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ TEST_CASE( "succeeding/conditions/not", "'Not' checks that should succeed" )
|
|||||||
REQUIRE_FALSE( 1 == 2 );
|
REQUIRE_FALSE( 1 == 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/conditions/not", "'Not' checks that should fail" )
|
TEST_CASE( "./failing/conditions/not", "'Not' checks that should fail" )
|
||||||
{
|
{
|
||||||
bool trueValue = true;
|
bool trueValue = true;
|
||||||
|
|
||||||
|
@ -28,26 +28,26 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
TEST_CASE( "./succeeding/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
||||||
{
|
{
|
||||||
REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
|
REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
|
||||||
REQUIRE_NOTHROW( thisDoesntThrow() );
|
REQUIRE_NOTHROW( thisDoesntThrow() );
|
||||||
REQUIRE_THROWS( thisThrows() );
|
REQUIRE_THROWS( thisThrows() );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
TEST_CASE( "./failing/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
||||||
{
|
{
|
||||||
CHECK_THROWS_AS( thisThrows(), std::string );
|
CHECK_THROWS_AS( thisThrows(), std::string );
|
||||||
CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error );
|
CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error );
|
||||||
CHECK_NOTHROW( thisThrows() );
|
CHECK_NOTHROW( thisThrows() );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/exceptions/implicit", "When unchecked exceptions are thrown they are always failures" )
|
TEST_CASE( "./failing/exceptions/implicit", "When unchecked exceptions are thrown they are always failures" )
|
||||||
{
|
{
|
||||||
throw std::domain_error( "unexpected exception" );
|
throw std::domain_error( "unexpected exception" );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/exceptions/implicit", "When unchecked exceptions are thrown, but caught, they do not affect the test" )
|
TEST_CASE( "./succeeding/exceptions/implicit", "When unchecked exceptions are thrown, but caught, they do not affect the test" )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -12,13 +12,13 @@
|
|||||||
|
|
||||||
#include "../catch.hpp"
|
#include "../catch.hpp"
|
||||||
|
|
||||||
TEST_CASE( "succeeding/message", "INFO and WARN do not abort tests" )
|
TEST_CASE( "./succeeding/message", "INFO and WARN do not abort tests" )
|
||||||
{
|
{
|
||||||
INFO( "this is a " << "message" ); // This should output the message if a failure occurs
|
INFO( "this is a " << "message" ); // This should output the message if a failure occurs
|
||||||
WARN( "this is a " << "warning" ); // This should always output the message but then continue
|
WARN( "this is a " << "warning" ); // This should always output the message but then continue
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/message/info/1", "INFO gets logged on failure" )
|
TEST_CASE( "./failing/message/info/1", "INFO gets logged on failure" )
|
||||||
{
|
{
|
||||||
INFO( "this message should be logged" );
|
INFO( "this message should be logged" );
|
||||||
INFO( "so should this" );
|
INFO( "so should this" );
|
||||||
@ -26,7 +26,7 @@ TEST_CASE( "failing/message/info/1", "INFO gets logged on failure" )
|
|||||||
REQUIRE( a == 1 );
|
REQUIRE( a == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "mixed/message/info/2", "INFO gets logged on failure" )
|
TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" )
|
||||||
{
|
{
|
||||||
INFO( "this message should be logged" );
|
INFO( "this message should be logged" );
|
||||||
int a = 2;
|
int a = 2;
|
||||||
@ -45,7 +45,7 @@ TEST_CASE( "mixed/message/info/2", "INFO gets logged on failure" )
|
|||||||
CHECK( a == 2 );
|
CHECK( a == 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "failing/message/fail", "FAIL aborts the test" )
|
TEST_CASE( "./failing/message/fail", "FAIL aborts the test" )
|
||||||
{
|
{
|
||||||
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
FAIL( "This is a " << "failure" ); // This should output the message and abort
|
||||||
}
|
}
|
@ -13,7 +13,7 @@
|
|||||||
#include "../catch.hpp"
|
#include "../catch.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
TEST_CASE( "succeeding/Misc/Sections", "random SECTION tests" )
|
TEST_CASE( "./succeeding/Misc/Sections", "random SECTION tests" )
|
||||||
{
|
{
|
||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
@ -30,7 +30,7 @@ TEST_CASE( "succeeding/Misc/Sections", "random SECTION tests" )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/Misc/Sections/nested", "nested SECTION tests" )
|
TEST_CASE( "./succeeding/Misc/Sections/nested", "nested SECTION tests" )
|
||||||
{
|
{
|
||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
@ -47,7 +47,7 @@ TEST_CASE( "succeeding/Misc/Sections/nested", "nested SECTION tests" )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "mixed/Misc/Sections/loops", "looped SECTION tests" )
|
TEST_CASE( "./mixed/Misc/Sections/loops", "looped SECTION tests" )
|
||||||
{
|
{
|
||||||
int a = 1;
|
int a = 1;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ TEST_CASE( "mixed/Misc/Sections/loops", "looped SECTION tests" )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "mixed/Misc/loops", "looped tests" )
|
TEST_CASE( "./mixed/Misc/loops", "looped tests" )
|
||||||
{
|
{
|
||||||
static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
|
static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ TEST_CASE( "mixed/Misc/loops", "looped tests" )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" )
|
TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr" )
|
||||||
{
|
{
|
||||||
std::cout << "Some information";
|
std::cout << "Some information";
|
||||||
|
|
||||||
|
@ -19,13 +19,13 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
|
|||||||
|
|
||||||
{
|
{
|
||||||
EmbeddedRunner runner;
|
EmbeddedRunner runner;
|
||||||
runner.runMatching( "succeeding/*" );
|
runner.runMatching( "./succeeding/*" );
|
||||||
CHECK( runner.getReporter().getSucceeded() == 53 );
|
CHECK( runner.getReporter().getSucceeded() == 53 );
|
||||||
CHECK( runner.getReporter().getFailed() == 0 );
|
CHECK( runner.getReporter().getFailed() == 0 );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
EmbeddedRunner runner;
|
EmbeddedRunner runner;
|
||||||
runner.runMatching( "failing/*" );
|
runner.runMatching( "./failing/*" );
|
||||||
|
|
||||||
CHECK( runner.getReporter().getSucceeded() == 0 );
|
CHECK( runner.getReporter().getSucceeded() == 0 );
|
||||||
CHECK( runner.getReporter().getFailed() == 53 );
|
CHECK( runner.getReporter().getFailed() == 53 );
|
||||||
@ -42,7 +42,7 @@ TEST_CASE( "selftest/succeeding", "Runs all Catch self tests that should succeed
|
|||||||
SelfTestConfig config;
|
SelfTestConfig config;
|
||||||
{
|
{
|
||||||
Runner runner( config );
|
Runner runner( config );
|
||||||
runner.runMatching( "succeeding/*" );
|
runner.runMatching( "./succeeding/*" );
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK( config.getReporter().getSucceeded() == 53 );
|
CHECK( config.getReporter().getSucceeded() == 53 );
|
||||||
@ -60,7 +60,7 @@ TEST_CASE( "selftest/failing", "Runs all Catch self tests that should fail and c
|
|||||||
SelfTestConfig config;
|
SelfTestConfig config;
|
||||||
{
|
{
|
||||||
Runner runner( config );
|
Runner runner( config );
|
||||||
runner.runMatching( "failing/*" );
|
runner.runMatching( "./failing/*" );
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK( config.getReporter().getSucceeded() == 0 );
|
CHECK( config.getReporter().getSucceeded() == 0 );
|
||||||
|
@ -24,7 +24,7 @@ namespace Catch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/Tricky/std::pair", "Parsing a std::pair" )
|
TEST_CASE( "./succeeding/Tricky/std::pair", "Parsing a std::pair" )
|
||||||
{
|
{
|
||||||
std::pair<int, int> aNicePair( 1, 2 );
|
std::pair<int, int> aNicePair( 1, 2 );
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ TEST_CASE( "succeeding/Tricky/std::pair", "Parsing a std::pair" )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value" )
|
TEST_CASE( "./succeeding/Tricky/complex lhs", "Where the LHS is not a simple value" )
|
||||||
{
|
{
|
||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
@ -51,7 +51,7 @@ struct Opaque
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_CASE( "failing/Tricky/non streamable type", "A failing expression with a non streamable type is still captured" )
|
TEST_CASE( "./failing/Tricky/non streamable type", "A failing expression with a non streamable type is still captured" )
|
||||||
{
|
{
|
||||||
|
|
||||||
Opaque o1, o2;
|
Opaque o1, o2;
|
||||||
|
@ -113,6 +113,7 @@ namespace Catch
|
|||||||
std::vector<TestCaseInfo> allTests = Hub::getTestCaseRegistry().getAllTests();
|
std::vector<TestCaseInfo> allTests = Hub::getTestCaseRegistry().getAllTests();
|
||||||
for( std::size_t i=0; i < allTests.size(); ++i )
|
for( std::size_t i=0; i < allTests.size(); ++i )
|
||||||
{
|
{
|
||||||
|
if( !allTests[i].isHidden() )
|
||||||
runTest( allTests[i] );
|
runTest( allTests[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,14 @@ namespace Catch
|
|||||||
return m_description;
|
return m_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
bool isHidden
|
||||||
|
()
|
||||||
|
const
|
||||||
|
{
|
||||||
|
return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/';
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
void swap
|
void swap
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user