mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-01 17:37:57 +00:00
Added className to TestCaseInfo
className is passed through from class based test methods and held in the TestCaseInfo. For free-function based test cases it is set to "global". The JUnit reporter uses the className value to populate he class attribute.
This commit is contained in:
parent
81cb69ef18
commit
78fba28c4b
7 changed files with 64 additions and 31 deletions
|
@ -16,10 +16,12 @@ namespace Catch {
|
|||
|
||||
|
||||
TestCaseInfo::TestCaseInfo( ITestCase* testCase,
|
||||
const char* name,
|
||||
const char* description,
|
||||
const std::string& className,
|
||||
const std::string& name,
|
||||
const std::string& description,
|
||||
const SourceLineInfo& lineInfo )
|
||||
: m_test( testCase ),
|
||||
m_className( className ),
|
||||
m_name( name ),
|
||||
m_description( description ),
|
||||
m_lineInfo( lineInfo ),
|
||||
|
@ -32,6 +34,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo()
|
||||
: m_test( NULL ),
|
||||
m_className(),
|
||||
m_name(),
|
||||
m_description(),
|
||||
m_isHidden( false )
|
||||
|
@ -39,6 +42,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other, const std::string& name )
|
||||
: m_test( other.m_test ),
|
||||
m_className( other.m_className ),
|
||||
m_name( name ),
|
||||
m_description( other.m_description ),
|
||||
m_tags( other.m_tags ),
|
||||
|
@ -48,6 +52,7 @@ namespace Catch {
|
|||
|
||||
TestCaseInfo::TestCaseInfo( const TestCaseInfo& other )
|
||||
: m_test( other.m_test ),
|
||||
m_className( other.m_className ),
|
||||
m_name( other.m_name ),
|
||||
m_description( other.m_description ),
|
||||
m_tags( other.m_tags ),
|
||||
|
@ -59,14 +64,15 @@ namespace Catch {
|
|||
m_test->invoke();
|
||||
}
|
||||
|
||||
const std::string& TestCaseInfo::getClassName() const {
|
||||
return m_className;
|
||||
}
|
||||
const std::string& TestCaseInfo::getName() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const std::string& TestCaseInfo::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
const SourceLineInfo& TestCaseInfo::getLineInfo() const {
|
||||
return m_lineInfo;
|
||||
}
|
||||
|
@ -89,13 +95,16 @@ namespace Catch {
|
|||
|
||||
void TestCaseInfo::swap( TestCaseInfo& other ) {
|
||||
m_test.swap( other.m_test );
|
||||
m_className.swap( other.m_className );
|
||||
m_name.swap( other.m_name );
|
||||
m_description.swap( other.m_description );
|
||||
m_lineInfo.swap( other.m_lineInfo );
|
||||
std::swap( m_lineInfo, other.m_lineInfo );
|
||||
}
|
||||
|
||||
bool TestCaseInfo::operator == ( const TestCaseInfo& other ) const {
|
||||
return m_test.get() == other.m_test.get() && m_name == other.m_name;
|
||||
return m_test.get() == other.m_test.get() &&
|
||||
m_name == other.m_name &&
|
||||
m_className == other.m_className;
|
||||
}
|
||||
|
||||
bool TestCaseInfo::operator < ( const TestCaseInfo& other ) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue