mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Fixed leak
This commit is contained in:
parent
5cf94a8043
commit
92f2d32f74
@ -40,4 +40,12 @@ TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value
|
|||||||
|
|
||||||
// This only captures part of the expression, but issues a warning about the rest
|
// This only captures part of the expression, but issues a warning about the rest
|
||||||
EXPECT( a == 2 || b == 2 );
|
EXPECT( a == 2 || b == 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE( "succeeding/Tricky/complex lhs/2", "Where the LHS is not a simple value" )
|
||||||
|
{
|
||||||
|
int a = 1;
|
||||||
|
|
||||||
|
// This only captures part of the expression, but issues a warning about the rest
|
||||||
|
// EXPECT( a + 1 == 2);
|
||||||
}
|
}
|
@ -66,8 +66,7 @@ public:
|
|||||||
m_expressionIncomplete = true;
|
m_expressionIncomplete = true;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ResultBuilder;
|
friend class ResultBuilder;
|
||||||
void setLhs( const std::string& lhs )
|
void setLhs( const std::string& lhs )
|
||||||
|
@ -48,9 +48,8 @@ namespace Catch
|
|||||||
|
|
||||||
TestCaseInfo& operator = ( const TestCaseInfo& other )
|
TestCaseInfo& operator = ( const TestCaseInfo& other )
|
||||||
{
|
{
|
||||||
test = other.test->clone();
|
TestCaseInfo temp( other );
|
||||||
name = other.name;
|
swap( temp );
|
||||||
description = description;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +72,13 @@ namespace Catch
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swap( TestCaseInfo& other )
|
||||||
|
{
|
||||||
|
std::swap( test, other.test );
|
||||||
|
name.swap( other.name );
|
||||||
|
description.swap( other.description );
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TestCase* test;
|
TestCase* test;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
Loading…
Reference in New Issue
Block a user