Add test for #914 (stringify truthy exprs in standard way)

This commit is contained in:
Martin Hořeňovský 2017-05-27 14:42:05 +02:00
parent 2d1739b429
commit ea48ae0f75
6 changed files with 80 additions and 13 deletions

View File

@ -59,6 +59,7 @@ set(TEST_SOURCES
${SELF_TEST_DIR}/CmdLineTests.cpp
${SELF_TEST_DIR}/CompilationTests.cpp
${SELF_TEST_DIR}/ConditionTests.cpp
${SELF_TEST_DIR}/DecompositionTests.cpp
${SELF_TEST_DIR}/EnumToString.cpp
${SELF_TEST_DIR}/ExceptionTests.cpp
${SELF_TEST_DIR}/GeneratorTests.cpp

View File

@ -595,6 +595,17 @@ MessageTests.cpp:<line number>:
warning:
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
-------------------------------------------------------------------------------
@ -942,6 +953,6 @@ with expansion:
"first" == "second"
===============================================================================
test cases: 167 | 119 passed | 44 failed | 4 failed as expected
assertions: 967 | 859 passed | 87 failed | 21 failed as expected
test cases: 168 | 119 passed | 45 failed | 4 failed as expected
assertions: 968 | 859 passed | 88 failed | 21 failed as expected

View File

@ -819,7 +819,7 @@ TrickyTests.cpp:<line number>:
PASSED:
REQUIRE( a )
with expansion:
true
0x<hex digits>
TrickyTests.cpp:<line number>:
PASSED:
@ -4571,7 +4571,7 @@ TrickyTests.cpp:<line number>:
PASSED:
CHECK( True )
with expansion:
true
1
TrickyTests.cpp:<line number>:
PASSED:
@ -4583,7 +4583,7 @@ TrickyTests.cpp:<line number>:
PASSED:
CHECK_FALSE( False )
with expansion:
!false
!0
-------------------------------------------------------------------------------
Operators at different namespace levels not hijacked by Koenig lookup
@ -6437,6 +6437,17 @@ TestMain.cpp:<line number>:
PASSED:
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
-------------------------------------------------------------------------------
@ -9472,6 +9483,6 @@ MiscTests.cpp:<line number>:
PASSED:
===============================================================================
test cases: 167 | 118 passed | 45 failed | 4 failed as expected
assertions: 969 | 859 passed | 89 failed | 21 failed as expected
test cases: 168 | 118 passed | 46 failed | 4 failed as expected
assertions: 970 | 859 passed | 90 failed | 21 failed as expected

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
<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/no" 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}">
<failure message="10 &lt; 10" type="REQUIRE">
current counter 10

View File

@ -890,7 +890,7 @@
a
</Original>
<Expanded>
true
0x<hex digits>
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
@ -4695,7 +4695,7 @@ re>"
True
</Original>
<Expanded>
true
1
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
@ -4711,7 +4711,7 @@ re>"
!False
</Original>
<Expanded>
!false
!0
</Expanded>
</Expression>
<OverallResult success="true"/>
@ -6912,6 +6912,17 @@ re>"
</Section>
<OverallResult success="true"/>
</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" >
<Info>
current counter 0
@ -10132,7 +10143,7 @@ spanner <OverallResult success="true"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="859" failures="90" expectedFailures="21"/>
<OverallResults successes="859" failures="91" expectedFailures="21"/>
</Group>
<OverallResults successes="859" failures="89" expectedFailures="21"/>
<OverallResults successes="859" failures="90" expectedFailures="21"/>
</Catch>

View 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));
}