Add tests for unscoped info

Update approval tests as new tests are added for messaging.
This commit is contained in:
Omer Ozarslan 2019-02-01 09:36:35 -06:00 committed by Martin Hořeňovský
parent 99575b45db
commit 7aee973a4a
6 changed files with 517 additions and 8 deletions

View File

@ -1285,6 +1285,7 @@ Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
loose text artifact loose text artifact
Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Previous info should not be seen' Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Previous info should not be seen'
Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'previous unscoped info SHOULD not be seen'
Misc.tests.cpp:<line number>: passed: l == std::numeric_limits<long long>::max() for: 9223372036854775807 (0x<hex digits>) Misc.tests.cpp:<line number>: passed: l == std::numeric_limits<long long>::max() for: 9223372036854775807 (0x<hex digits>)
== ==
9223372036854775807 (0x<hex digits>) 9223372036854775807 (0x<hex digits>)
@ -1306,6 +1307,8 @@ Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 mes
Misc.tests.cpp:<line number>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[5] (8) is even' Misc.tests.cpp:<line number>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[5] (8) is even'
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[6] (13) is even' Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[6] (13) is even'
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[7] (21) is even' Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[7] (21) is even'
Message.tests.cpp:<line number>: warning: 'info' with 2 messages: 'unscoped info' and 'and warn may mix'
Message.tests.cpp:<line number>: warning: 'info' with 2 messages: 'unscoped info' and 'they are not cleared after warnings'
Misc.tests.cpp:<line number>: failed: a == b for: 1 == 2 Misc.tests.cpp:<line number>: failed: a == b for: 1 == 2
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
Misc.tests.cpp:<line number>: passed: a < b for: 1 < 2 Misc.tests.cpp:<line number>: passed: a < b for: 1 < 2
@ -1315,6 +1318,9 @@ Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
Tricky.tests.cpp:<line number>: passed: s == "7" for: "7" == "7" Tricky.tests.cpp:<line number>: passed: s == "7" for: "7" == "7"
Tricky.tests.cpp:<line number>: passed: ti == typeid(int) for: {?} == {?} Tricky.tests.cpp:<line number>: passed: ti == typeid(int) for: {?} == {?}
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen only for the FIRST assertion IF info is printed for passing assertions'
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen only for the SECOND assertion IF info is printed for passing assertions'
Message.tests.cpp:<line number>: failed: false with 1 message: 'this SHOULD be seen'
Misc.tests.cpp:<line number>: passed: makeString( false ) != static_cast<char*>(0) for: "valid string" != {null string} Misc.tests.cpp:<line number>: passed: makeString( false ) != static_cast<char*>(0) for: "valid string" != {null string}
Misc.tests.cpp:<line number>: passed: makeString( true ) == static_cast<char*>(0) for: {null string} == {null string} Misc.tests.cpp:<line number>: passed: makeString( true ) == static_cast<char*>(0) for: {null string} == {null string}
Tricky.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0 Tricky.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0
@ -1322,6 +1328,12 @@ ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pair )
== ==
"{ { 42, "Arthur" }, { "Ford", 24 } }" "{ { 42, "Arthur" }, { "Ford", 24 } }"
Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0 Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen IF info is printed for passing assertions'
Message.tests.cpp:<line number>: failed: false with 2 messages: 'this SHOULD be seen' and 'this SHOULD also be seen'
Message.tests.cpp:<line number>: failed: false with 1 message: 'this SHOULD be seen only ONCE'
Message.tests.cpp:<line number>: passed: true
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY also be seen only ONCE IF info is printed for passing assertions'
Message.tests.cpp:<line number>: passed: true
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1 Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1
Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
@ -1341,6 +1353,8 @@ String.tests.cpp:<line number>: passed: Catch::replaceInPlace( s, "'", "|'" ) fo
String.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" String.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
Misc.tests.cpp:<line number>: failed: false with 1 message: '3' Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7' Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }" ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }" ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }"
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
@ -1462,5 +1476,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed:
Failed 70 test cases, failed 130 assertions. Failed 77 test cases, failed 138 assertions.

View File

@ -1056,6 +1056,16 @@ Message.tests.cpp:<line number>: FAILED:
explicitly with message: explicitly with message:
Previous info should not be seen Previous info should not be seen
-------------------------------------------------------------------------------
just failure after unscoped info
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
explicitly with message:
previous unscoped info SHOULD not be seen
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
looped SECTION tests looped SECTION tests
b is currently: 0 b is currently: 0
@ -1128,6 +1138,18 @@ with expansion:
with message: with message:
Testing if fib[7] (21) is even Testing if fib[7] (21) is even
-------------------------------------------------------------------------------
mix info, unscoped info and warning
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: warning:
and warn may mix
Message.tests.cpp:<line number>: warning:
they are not cleared after warnings
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
more nested SECTION tests more nested SECTION tests
doesn't equal doesn't equal
@ -1141,6 +1163,40 @@ Misc.tests.cpp:<line number>: FAILED:
with expansion: with expansion:
1 == 2 1 == 2
-------------------------------------------------------------------------------
not prints unscoped info from previous failures
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
this SHOULD be seen
-------------------------------------------------------------------------------
prints unscoped info on failure
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with messages:
this SHOULD be seen
this SHOULD also be seen
-------------------------------------------------------------------------------
prints unscoped info only for the first assertion
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
this SHOULD be seen only ONCE
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
send a single char to INFO send a single char to INFO
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -1164,6 +1220,28 @@ with messages:
hi hi
i := 7 i := 7
-------------------------------------------------------------------------------
stacks unscoped info in loops
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with messages:
Count 1 to 3...
1
2
3
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with messages:
Count 4 to 6...
4
5
6
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
string literals of different sizes can be compared string literals of different sizes can be compared
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -1186,6 +1264,6 @@ due to unexpected exception with message:
Why would you throw a std::string? Why would you throw a std::string?
=============================================================================== ===============================================================================
test cases: 247 | 186 passed | 57 failed | 4 failed as expected test cases: 255 | 189 passed | 62 failed | 4 failed as expected
assertions: 1381 | 1244 passed | 116 failed | 21 failed as expected assertions: 1393 | 1250 passed | 122 failed | 21 failed as expected

View File

@ -9368,6 +9368,16 @@ Message.tests.cpp:<line number>: FAILED:
explicitly with message: explicitly with message:
Previous info should not be seen Previous info should not be seen
-------------------------------------------------------------------------------
just failure after unscoped info
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
explicitly with message:
previous unscoped info SHOULD not be seen
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
just info just info
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -9377,6 +9387,15 @@ Message.tests.cpp:<line number>
No assertions in test case 'just info' No assertions in test case 'just info'
-------------------------------------------------------------------------------
just unscoped info
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
No assertions in test case 'just unscoped info'
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
long long long long
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -9572,6 +9591,25 @@ with expansion:
with message: with message:
Testing if fib[7] (21) is even Testing if fib[7] (21) is even
-------------------------------------------------------------------------------
mix info, unscoped info and warning
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: warning:
info
unscoped info
and warn may mix
Message.tests.cpp:<line number>: warning:
info
unscoped info
they are not cleared after warnings
No assertions in test case 'mix info, unscoped info and warning'
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
more nested SECTION tests more nested SECTION tests
doesn't equal doesn't equal
@ -9671,6 +9709,29 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED: Misc.tests.cpp:<line number>: PASSED:
-------------------------------------------------------------------------------
not prints unscoped info from previous failures
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
REQUIRE( true )
with message:
this MAY be seen only for the FIRST assertion IF info is printed for passing
assertions
Message.tests.cpp:<line number>: PASSED:
REQUIRE( true )
with message:
this MAY be seen only for the SECOND assertion IF info is printed for passing
assertions
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with message:
this SHOULD be seen
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
null strings null strings
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -9722,6 +9783,51 @@ Tricky.tests.cpp:<line number>: PASSED:
with expansion: with expansion:
0 == 0 0 == 0
-------------------------------------------------------------------------------
print unscoped info if passing unscoped info is printed
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: PASSED:
REQUIRE( true )
with message:
this MAY be seen IF info is printed for passing assertions
-------------------------------------------------------------------------------
prints unscoped info on failure
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
REQUIRE( false )
with messages:
this SHOULD be seen
this SHOULD also be seen
-------------------------------------------------------------------------------
prints unscoped info only for the first assertion
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with message:
this SHOULD be seen only ONCE
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
with message:
this MAY also be seen only ONCE IF info is printed for passing assertions
Message.tests.cpp:<line number>: PASSED:
CHECK( true )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
random SECTION tests random SECTION tests
doesn't equal doesn't equal
@ -9902,6 +10008,28 @@ with messages:
hi hi
i := 7 i := 7
-------------------------------------------------------------------------------
stacks unscoped info in loops
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
...............................................................................
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with messages:
Count 1 to 3...
1
2
3
Message.tests.cpp:<line number>: FAILED:
CHECK( false )
with messages:
Count 4 to 6...
4
5
6
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
std::map is convertible string std::map is convertible string
empty empty
@ -10721,6 +10849,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED: Misc.tests.cpp:<line number>: PASSED:
=============================================================================== ===============================================================================
test cases: 247 | 173 passed | 70 failed | 4 failed as expected test cases: 255 | 174 passed | 77 failed | 4 failed as expected
assertions: 1395 | 1244 passed | 130 failed | 21 failed as expected assertions: 1409 | 1250 passed | 138 failed | 21 failed as expected

View File

@ -4,7 +4,7 @@
<property name="random-seed" value="1"/> <property name="random-seed" value="1"/>
</properties> </properties>
loose text artifact loose text artifact
<testsuite name="<exe-name>" errors="17" failures="114" tests="1396" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testsuite name="<exe-name>" errors="17" failures="122" tests="1410" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
@ -865,6 +865,12 @@ Misc.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="just failure" time="{duration}"> <testcase classname="<exe-name>.global" name="just failure" time="{duration}">
<failure type="FAIL"> <failure type="FAIL">
Previous info should not be seen Previous info should not be seen
Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="just failure after unscoped info" time="{duration}">
<failure type="FAIL">
previous unscoped info SHOULD not be seen
Message.tests.cpp:<line number> Message.tests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
@ -913,6 +919,7 @@ Testing if fib[7] (21) is even
Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>
<testcase classname="<exe-name>.global" name="mix info, unscoped info and warning" time="{duration}"/>
<testcase classname="<exe-name>.global" name="more nested SECTION tests/equal/doesn't equal" time="{duration}"> <testcase classname="<exe-name>.global" name="more nested SECTION tests/equal/doesn't equal" time="{duration}">
<failure message="1 == 2" type="REQUIRE"> <failure message="1 == 2" type="REQUIRE">
Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>
@ -925,10 +932,30 @@ Misc.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/> <testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/> <testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/> <testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
<testcase classname="<exe-name>.global" name="not prints unscoped info from previous failures" time="{duration}">
<failure message="false" type="REQUIRE">
this SHOULD be seen
Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="null strings" time="{duration}"/> <testcase classname="<exe-name>.global" name="null strings" time="{duration}"/>
<testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/> <testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/>
<testcase classname="<exe-name>.global" name="pair&lt;pair&lt;int,const char *,pair&lt;std::string,int> > -> toString" time="{duration}"/> <testcase classname="<exe-name>.global" name="pair&lt;pair&lt;int,const char *,pair&lt;std::string,int> > -> toString" time="{duration}"/>
<testcase classname="<exe-name>.global" name="pointer to class" time="{duration}"/> <testcase classname="<exe-name>.global" name="pointer to class" time="{duration}"/>
<testcase classname="<exe-name>.global" name="print unscoped info if passing unscoped info is printed" time="{duration}"/>
<testcase classname="<exe-name>.global" name="prints unscoped info on failure" time="{duration}">
<failure message="false" type="REQUIRE">
this SHOULD be seen
this SHOULD also be seen
Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="prints unscoped info only for the first assertion" time="{duration}">
<failure message="false" type="CHECK">
this SHOULD be seen only ONCE
Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}"/> <testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}"/>
<testcase classname="<exe-name>.global" name="random SECTION tests/not equal" time="{duration}"/> <testcase classname="<exe-name>.global" name="random SECTION tests/not equal" time="{duration}"/>
<testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}"/> <testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}"/>
@ -948,6 +975,22 @@ Misc.tests.cpp:<line number>
<failure message="false" type="REQUIRE"> <failure message="false" type="REQUIRE">
hi hi
i := 7 i := 7
Message.tests.cpp:<line number>
</failure>
</testcase>
<testcase classname="<exe-name>.global" name="stacks unscoped info in loops" time="{duration}">
<failure message="false" type="CHECK">
Count 1 to 3...
1
2
3
Message.tests.cpp:<line number>
</failure>
<failure message="false" type="CHECK">
Count 4 to 6...
4
5
6
Message.tests.cpp:<line number> Message.tests.cpp:<line number>
</failure> </failure>
</testcase> </testcase>

View File

@ -11541,9 +11541,18 @@ loose text artifact
</Failure> </Failure>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="just failure after unscoped info" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
previous unscoped info SHOULD not be seen
</Failure>
<OverallResult success="false"/>
</TestCase>
<TestCase name="just info" tags="[info][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <TestCase name="just info" tags="[info][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="just unscoped info" tags="[info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<OverallResult success="false"/>
</TestCase>
<TestCase name="long long" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <TestCase name="long long" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original> <Original>
@ -11761,6 +11770,27 @@ loose text artifact
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="mix info, unscoped info and warning" tags="[info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
info
</Info>
<Info>
unscoped info
</Info>
<Warning>
and warn may mix
</Warning>
<Info>
info
</Info>
<Info>
unscoped info
</Info>
<Warning>
they are not cleared after warnings
</Warning>
<OverallResult success="false"/>
</TestCase>
<TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Section name="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
@ -11864,6 +11894,42 @@ loose text artifact
<TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="not prints unscoped info from previous failures" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
this MAY be seen only for the FIRST assertion IF info is printed for passing assertions
</Info>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Info>
this MAY be seen only for the SECOND assertion IF info is printed for passing assertions
</Info>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Info>
this SHOULD be seen
</Info>
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="null strings" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <TestCase name="null strings" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Original> <Original>
@ -11918,6 +11984,78 @@ loose text artifact
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="print unscoped info if passing unscoped info is printed" tags="[info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
this MAY be seen IF info is printed for passing assertions
</Info>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="prints unscoped info on failure" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
this SHOULD be seen
</Info>
<Info>
this SHOULD also be seen
</Info>
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="prints unscoped info only for the first assertion" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
this SHOULD be seen only ONCE
</Info>
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Info>
this MAY also be seen only ONCE IF info is printed for passing assertions
</Info>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
true
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
@ -12121,6 +12259,49 @@ loose text artifact
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </TestCase>
<TestCase name="stacks unscoped info in loops" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Info>
Count 1 to 3...
</Info>
<Info>
1
</Info>
<Info>
2
</Info>
<Info>
3
</Info>
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<Info>
Count 4 to 6...
</Info>
<Info>
4
</Info>
<Info>
5
</Info>
<Info>
6
</Info>
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
false
</Original>
<Expanded>
false
</Expanded>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="std::map is convertible string" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <TestCase name="std::map is convertible string" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Section name="empty" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="empty" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
@ -12972,7 +13153,7 @@ loose text artifact
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="1244" failures="131" expectedFailures="21"/> <OverallResults successes="1250" failures="139" expectedFailures="21"/>
</Group> </Group>
<OverallResults successes="1244" failures="130" expectedFailures="21"/> <OverallResults successes="1250" failures="138" expectedFailures="21"/>
</Catch> </Catch>

View File

@ -132,6 +132,71 @@ TEST_CASE( "Pointers can be converted to strings", "[messages][.][approvals]" )
WARN( "toString(p): " << ::Catch::Detail::stringify( &p ) ); WARN( "toString(p): " << ::Catch::Detail::stringify( &p ) );
} }
template <typename T>
static void unscoped_info( T msg ) {
UNSCOPED_INFO( msg );
}
TEST_CASE( "just unscoped info", "[unscoped][info]" ) {
unscoped_info( "this should NOT be seen" );
unscoped_info( "this also should NOT be seen" );
}
TEST_CASE( "just failure after unscoped info", "[failing][.][unscoped][info]" ) {
FAIL( "previous unscoped info SHOULD not be seen" );
}
TEST_CASE( "print unscoped info if passing unscoped info is printed", "[unscoped][info]" ) {
unscoped_info( "this MAY be seen IF info is printed for passing assertions" );
REQUIRE( true );
}
TEST_CASE( "prints unscoped info on failure", "[failing][.][unscoped][info]" ) {
unscoped_info( "this SHOULD be seen" );
unscoped_info( "this SHOULD also be seen" );
REQUIRE( false );
unscoped_info( "but this should NOT be seen" );
}
TEST_CASE( "not prints unscoped info from previous failures", "[failing][.][unscoped][info]" ) {
unscoped_info( "this MAY be seen only for the FIRST assertion IF info is printed for passing assertions" );
REQUIRE( true );
unscoped_info( "this MAY be seen only for the SECOND assertion IF info is printed for passing assertions" );
REQUIRE( true );
unscoped_info( "this SHOULD be seen" );
REQUIRE( false );
}
TEST_CASE( "prints unscoped info only for the first assertion", "[failing][.][unscoped][info]" ) {
unscoped_info( "this SHOULD be seen only ONCE" );
CHECK( false );
CHECK( true );
unscoped_info( "this MAY also be seen only ONCE IF info is printed for passing assertions" );
CHECK( true );
CHECK( true );
}
TEST_CASE( "stacks unscoped info in loops", "[failing][.][unscoped][info]" ) {
UNSCOPED_INFO("Count 1 to 3...");
for (int i = 1; i <= 3; i++) {
unscoped_info(i);
}
CHECK( false );
UNSCOPED_INFO("Count 4 to 6...");
for (int i = 4; i <= 6; i++) {
unscoped_info(i);
}
CHECK( false );
}
TEST_CASE( "mix info, unscoped info and warning", "[unscoped][info]" ) {
INFO("info");
unscoped_info("unscoped info");
WARN("and warn may mix");
WARN("they are not cleared after warnings");
}
TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" ) { TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" ) {
int a = 1; int a = 1;
int b = 2; int b = 2;