Skip to content

Commit

Permalink
Enable hiding of test cases via tags that start with '[.', such as [.…
Browse files Browse the repository at this point in the history
…integration]. issue #13
  • Loading branch information
martinmoene committed Jul 22, 2015
1 parent 839d348 commit 6ab47e8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,9 @@ inline bool select( text name, texts include )
auto none = []( texts args ) { return args.size() == 0; };

#if lest_FEATURE_REGEX_SEARCH
auto hidden = []( text name ){ return match( { "\\[\\.\\]", "\\[hide\\]" }, name ); };
auto hidden = []( text name ){ return match( { "\\[\\..*", "\\[hide\\]" }, name ); };
#else
auto hidden = []( text name ){ return match( { "[.]", "[hide]" }, name ); };
auto hidden = []( text name ){ return match( { "[.", "[hide]" }, name ); };
#endif

if ( none( include ) )
Expand Down
2 changes: 1 addition & 1 deletion lest_cpp03.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ inline bool hidden( text name )
#if lest_FEATURE_REGEX_SEARCH
texts skipped; skipped.push_back( "\\[\\.\\]" ); skipped.push_back( "\\[hide\\]" );
#else
texts skipped; skipped.push_back( "[.]" ); skipped.push_back( "[hide]" );
texts skipped; skipped.push_back( "[." ); skipped.push_back( "[hide]" );
#endif
return match( skipped, name );
}
Expand Down
7 changes: 6 additions & 1 deletion test/test_lest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,17 @@ const lest::test specification[] =
EXPECT( divide( 22, 7 ) != approx( 3.141 ).epsilon( 0.0001 ) );
},

CASE( "Skips tests tagged [hide]" )
{
EXPECT( false );
},

CASE( "Skips tests tagged [.]" )
{
EXPECT( false );
},

CASE( "Skips tests tagged [hide]" )
CASE( "Skips tests with tags that start with [.followed by anything]" )
{
EXPECT( false );
},
Expand Down
7 changes: 6 additions & 1 deletion test/test_lest_cpp03.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,17 @@ CASE( "Approximate to Pi compares properly [approx][pi]" )
EXPECT( f::divide( 22, 7 ) != approx( 3.141 ).epsilon( 0.0001 ) );
}

CASE( "Skips tests tagged [hide]" )
{
EXPECT( false );
}

CASE( "Skips tests tagged [.]" )
{
EXPECT( false );
}

CASE( "Skips tests tagged [hide]" )
CASE( "Skips tests with tags that start with [.followed by anything]" )
{
EXPECT( false );
}
Expand Down

0 comments on commit 6ab47e8

Please sign in to comment.