Capture test case hidden status in member variable

This commit is contained in:
Phil Nash 2012-09-12 18:40:24 +01:00
parent f7418eb2dd
commit dea756f699
2 changed files with 11 additions and 6 deletions

View File

@ -45,6 +45,7 @@ namespace Catch {
std::string m_name; std::string m_name;
std::string m_description; std::string m_description;
SourceLineInfo m_lineInfo; SourceLineInfo m_lineInfo;
bool m_isHidden;
}; };
} }

View File

@ -20,27 +20,31 @@ namespace Catch {
: m_test( testCase ), : m_test( testCase ),
m_name( name ), m_name( name ),
m_description( description ), m_description( description ),
m_lineInfo( lineInfo ) m_lineInfo( lineInfo ),
m_isHidden( startsWith( name, "./" ) )
{} {}
TestCaseInfo::TestCaseInfo() TestCaseInfo::TestCaseInfo()
: m_test( NULL ), : m_test( NULL ),
m_name(), m_name(),
m_description() m_description(),
m_isHidden( false )
{} {}
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name ) TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name )
: m_test( other.m_test ), : m_test( other.m_test ),
m_name( name ), m_name( name ),
m_description( other.m_description ), m_description( other.m_description ),
m_lineInfo( other.m_lineInfo ) m_lineInfo( other.m_lineInfo ),
m_isHidden( other.m_isHidden )
{} {}
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other ) TestCaseInfo::TestCaseInfo( const TestCaseInfo& other )
: m_test( other.m_test ), : m_test( other.m_test ),
m_name( other.m_name ), m_name( other.m_name ),
m_description( other.m_description ), m_description( other.m_description ),
m_lineInfo( other.m_lineInfo ) m_lineInfo( other.m_lineInfo ),
m_isHidden( other.m_isHidden )
{} {}
void TestCaseInfo::invoke() const { void TestCaseInfo::invoke() const {
@ -60,7 +64,7 @@ namespace Catch {
} }
bool TestCaseInfo::isHidden() const { bool TestCaseInfo::isHidden() const {
return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/'; return m_isHidden;
} }
void TestCaseInfo::swap( TestCaseInfo& other ) { void TestCaseInfo::swap( TestCaseInfo& other ) {