mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Add test for #914 (stringify truthy exprs in standard way)
This commit is contained in:
parent
2d1739b429
commit
ea48ae0f75
@ -59,6 +59,7 @@ set(TEST_SOURCES
|
|||||||
${SELF_TEST_DIR}/CmdLineTests.cpp
|
${SELF_TEST_DIR}/CmdLineTests.cpp
|
||||||
${SELF_TEST_DIR}/CompilationTests.cpp
|
${SELF_TEST_DIR}/CompilationTests.cpp
|
||||||
${SELF_TEST_DIR}/ConditionTests.cpp
|
${SELF_TEST_DIR}/ConditionTests.cpp
|
||||||
|
${SELF_TEST_DIR}/DecompositionTests.cpp
|
||||||
${SELF_TEST_DIR}/EnumToString.cpp
|
${SELF_TEST_DIR}/EnumToString.cpp
|
||||||
${SELF_TEST_DIR}/ExceptionTests.cpp
|
${SELF_TEST_DIR}/ExceptionTests.cpp
|
||||||
${SELF_TEST_DIR}/GeneratorTests.cpp
|
${SELF_TEST_DIR}/GeneratorTests.cpp
|
||||||
|
@ -595,6 +595,17 @@ MessageTests.cpp:<line number>:
|
|||||||
warning:
|
warning:
|
||||||
toString(p): 0x<hex digits>
|
toString(p): 0x<hex digits>
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Reconstruction should be based on stringification: #914
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
DecompositionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
DecompositionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( truthy(false) )
|
||||||
|
with expansion:
|
||||||
|
Hey, its truthy!
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
SCOPED_INFO is reset for each loop
|
SCOPED_INFO is reset for each loop
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -942,6 +953,6 @@ with expansion:
|
|||||||
"first" == "second"
|
"first" == "second"
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 167 | 119 passed | 44 failed | 4 failed as expected
|
test cases: 168 | 119 passed | 45 failed | 4 failed as expected
|
||||||
assertions: 967 | 859 passed | 87 failed | 21 failed as expected
|
assertions: 968 | 859 passed | 88 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ TrickyTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE( a )
|
REQUIRE( a )
|
||||||
with expansion:
|
with expansion:
|
||||||
true
|
0x<hex digits>
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>:
|
TrickyTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -4571,7 +4571,7 @@ TrickyTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK( True )
|
CHECK( True )
|
||||||
with expansion:
|
with expansion:
|
||||||
true
|
1
|
||||||
|
|
||||||
TrickyTests.cpp:<line number>:
|
TrickyTests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
@ -4583,7 +4583,7 @@ TrickyTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK_FALSE( False )
|
CHECK_FALSE( False )
|
||||||
with expansion:
|
with expansion:
|
||||||
!false
|
!0
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Operators at different namespace levels not hijacked by Koenig lookup
|
Operators at different namespace levels not hijacked by Koenig lookup
|
||||||
@ -6437,6 +6437,17 @@ TestMain.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) )
|
REQUIRE_THROWS_WITH( parseIntoConfig( argv, config ), Contains( "colour mode must be one of" ) )
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Reconstruction should be based on stringification: #914
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
DecompositionTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
DecompositionTests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( truthy(false) )
|
||||||
|
with expansion:
|
||||||
|
Hey, its truthy!
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
SCOPED_INFO is reset for each loop
|
SCOPED_INFO is reset for each loop
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -9472,6 +9483,6 @@ MiscTests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 167 | 118 passed | 45 failed | 4 failed as expected
|
test cases: 168 | 118 passed | 46 failed | 4 failed as expected
|
||||||
assertions: 969 | 859 passed | 89 failed | 21 failed as expected
|
assertions: 970 | 859 passed | 90 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesspanner>
|
<testsuitesspanner>
|
||||||
<testsuite name="<exe-name>" errors="13" failures="77" tests="970" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="13" failures="78" tests="971" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
|
||||||
<testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
|
<testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
|
||||||
<error type="TEST_CASE">
|
<error type="TEST_CASE">
|
||||||
@ -443,6 +443,11 @@ MessageTests.cpp:<line number>
|
|||||||
<testcase classname="Process can be configured on command line" name="use-colour/yes" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="use-colour/yes" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="use-colour/no" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="use-colour/no" time="{duration}"/>
|
||||||
<testcase classname="Process can be configured on command line" name="use-colour/error" time="{duration}"/>
|
<testcase classname="Process can be configured on command line" name="use-colour/error" time="{duration}"/>
|
||||||
|
<testcase classname="global" name="Reconstruction should be based on stringification: #914" time="{duration}">
|
||||||
|
<failure message="Hey, its truthy!" type="CHECK">
|
||||||
|
DecompositionTests.cpp:<line number>
|
||||||
|
</failure>
|
||||||
|
</testcase>
|
||||||
<testcase classname="global" name="SCOPED_INFO is reset for each loop" time="{duration}">
|
<testcase classname="global" name="SCOPED_INFO is reset for each loop" time="{duration}">
|
||||||
<failure message="10 < 10" type="REQUIRE">
|
<failure message="10 < 10" type="REQUIRE">
|
||||||
current counter 10
|
current counter 10
|
||||||
|
@ -890,7 +890,7 @@
|
|||||||
a
|
a
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
true
|
0x<hex digits>
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||||
@ -4695,7 +4695,7 @@ re>"
|
|||||||
True
|
True
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
true
|
1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||||
@ -4711,7 +4711,7 @@ re>"
|
|||||||
!False
|
!False
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
!false
|
!0
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
@ -6912,6 +6912,17 @@ re>"
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing][hide]" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||||
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
truthy(false)
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
Hey, its truthy!
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResult success="false"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="SCOPED_INFO is reset for each loop" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
<TestCase name="SCOPED_INFO is reset for each loop" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||||
<Info>
|
<Info>
|
||||||
current counter 0
|
current counter 0
|
||||||
@ -10132,7 +10143,7 @@ spanner <OverallResult success="true"/>
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="859" failures="90" expectedFailures="21"/>
|
<OverallResults successes="859" failures="91" expectedFailures="21"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="859" failures="89" expectedFailures="21"/>
|
<OverallResults successes="859" failures="90" expectedFailures="21"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
28
projects/SelfTest/DecompositionTests.cpp
Normal file
28
projects/SelfTest/DecompositionTests.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 27/5/2017.
|
||||||
|
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||||
|
*
|
||||||
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
struct truthy {
|
||||||
|
truthy(bool b):m_value(b){}
|
||||||
|
operator bool() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool m_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& o, truthy) {
|
||||||
|
o << "Hey, its truthy!";
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") {
|
||||||
|
CHECK(truthy(false));
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user