From dea756f699f23e2ee23e02099e3989d8897d5194 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 12 Sep 2012 18:40:24 +0100 Subject: [PATCH] Capture test case hidden status in member variable --- include/internal/catch_test_case_info.h | 3 ++- include/internal/catch_test_case_info.hpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/internal/catch_test_case_info.h b/include/internal/catch_test_case_info.h index b7b9bc5d..4fbfaa65 100644 --- a/include/internal/catch_test_case_info.h +++ b/include/internal/catch_test_case_info.h @@ -44,7 +44,8 @@ namespace Catch { Ptr m_test; std::string m_name; std::string m_description; - SourceLineInfo m_lineInfo; + SourceLineInfo m_lineInfo; + bool m_isHidden; }; } diff --git a/include/internal/catch_test_case_info.hpp b/include/internal/catch_test_case_info.hpp index 51258a7d..fa8bd40f 100644 --- a/include/internal/catch_test_case_info.hpp +++ b/include/internal/catch_test_case_info.hpp @@ -20,27 +20,31 @@ namespace Catch { : m_test( testCase ), m_name( name ), m_description( description ), - m_lineInfo( lineInfo ) + m_lineInfo( lineInfo ), + m_isHidden( startsWith( name, "./" ) ) {} TestCaseInfo::TestCaseInfo() : m_test( NULL ), m_name(), - m_description() + m_description(), + m_isHidden( false ) {} TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name ) : m_test( other.m_test ), m_name( name ), 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 ) : m_test( other.m_test ), m_name( other.m_name ), m_description( other.m_description ), - m_lineInfo( other.m_lineInfo ) + m_lineInfo( other.m_lineInfo ), + m_isHidden( other.m_isHidden ) {} void TestCaseInfo::invoke() const { @@ -60,7 +64,7 @@ namespace Catch { } bool TestCaseInfo::isHidden() const { - return m_name.size() >= 2 && m_name[0] == '.' && m_name[1] == '/'; + return m_isHidden; } void TestCaseInfo::swap( TestCaseInfo& other ) {