Add tests for #1403

This commit is contained in:
Martin Hořeňovský 2018-10-13 14:43:58 +02:00
parent 6cede0101a
commit aaaac35d92
7 changed files with 75 additions and 10 deletions

View File

@ -13,6 +13,7 @@ Misc.tests.cpp:<line number>: passed:
Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"'
Compilation.tests.cpp:<line number>: passed: Compilation.tests.cpp:<line number>: passed:
Compilation.tests.cpp:<line number>: passed: h1 == h2 for: [1403 helper] == [1403 helper]
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42' Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'

View File

@ -1096,6 +1096,6 @@ due to unexpected exception with message:
Why would you throw a std::string? Why would you throw a std::string?
=============================================================================== ===============================================================================
test cases: 213 | 160 passed | 49 failed | 4 failed as expected test cases: 214 | 161 passed | 49 failed | 4 failed as expected
assertions: 1228 | 1099 passed | 108 failed | 21 failed as expected assertions: 1229 | 1100 passed | 108 failed | 21 failed as expected

View File

@ -135,6 +135,18 @@ Compilation.tests.cpp:<line number>
Compilation.tests.cpp:<line number>: Compilation.tests.cpp:<line number>:
PASSED: PASSED:
-------------------------------------------------------------------------------
#1403
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
...............................................................................
Compilation.tests.cpp:<line number>:
PASSED:
REQUIRE( h1 == h2 )
with expansion:
[1403 helper] == [1403 helper]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
#748 - captures with unexpected exceptions #748 - captures with unexpected exceptions
outside assertions outside assertions
@ -10834,6 +10846,6 @@ Misc.tests.cpp:<line number>:
PASSED: PASSED:
=============================================================================== ===============================================================================
test cases: 213 | 147 passed | 62 failed | 4 failed as expected test cases: 214 | 148 passed | 62 failed | 4 failed as expected
assertions: 1242 | 1099 passed | 122 failed | 21 failed as expected assertions: 1243 | 1100 passed | 122 failed | 21 failed as expected

View File

@ -135,6 +135,18 @@ Compilation.tests.cpp:<line number>
Compilation.tests.cpp:<line number>: Compilation.tests.cpp:<line number>:
PASSED: PASSED:
-------------------------------------------------------------------------------
#1403
-------------------------------------------------------------------------------
Compilation.tests.cpp:<line number>
...............................................................................
Compilation.tests.cpp:<line number>:
PASSED:
REQUIRE( h1 == h2 )
with expansion:
[1403 helper] == [1403 helper]
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
#748 - captures with unexpected exceptions #748 - captures with unexpected exceptions
outside assertions outside assertions
@ -341,6 +353,6 @@ with expansion:
!true !true
=============================================================================== ===============================================================================
test cases: 14 | 11 passed | 1 failed | 2 failed as expected test cases: 15 | 12 passed | 1 failed | 2 failed as expected
assertions: 38 | 31 passed | 4 failed | 3 failed as expected assertions: 39 | 32 passed | 4 failed | 3 failed as expected

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact <testsuitesloose text artifact
> >
<testsuite name="<exe-name>" errors="17" failures="106" tests="1243" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testsuite name="<exe-name>" errors="17" failures="106" tests="1244" 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}"/>
@ -9,6 +9,7 @@
<testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1238" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1238" time="{duration}"/>
<testcase classname="<exe-name>.(Fixture_1245&lt;int, int>)" name="#1245" time="{duration}"/> <testcase classname="<exe-name>.(Fixture_1245&lt;int, int>)" name="#1245" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#1403" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}"> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
<error type="TEST_CASE"> <error type="TEST_CASE">
expected exception expected exception

View File

@ -130,6 +130,17 @@
<TestCase name="#1245" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > <TestCase name="#1245" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="#1403" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
<Original>
h1 == h2
</Original>
<Expanded>
[1403 helper] == [1403 helper]
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
<Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
<Info> <Info>
@ -11321,7 +11332,7 @@ loose text artifact
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="1099" failures="123" expectedFailures="21"/> <OverallResults successes="1100" failures="123" expectedFailures="21"/>
</Group> </Group>
<OverallResults successes="1099" failures="122" expectedFailures="21"/> <OverallResults successes="1100" failures="122" expectedFailures="21"/>
</Catch> </Catch>

View File

@ -5,6 +5,27 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
// Setup for #1403 -- look for global overloads of operator << for classes
// in a different namespace.
#include <ostream>
namespace foo {
struct helper_1403 {
bool operator==(helper_1403) const { return true; }
};
}
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#endif
std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
return out << "[1403 helper]";
}
///////////////////////////////
#include "catch.hpp" #include "catch.hpp"
#include <cstring> #include <cstring>
@ -153,5 +174,12 @@ namespace { namespace CompilationTests {
TEST_CASE_METHOD((Fixture_1245<int, int>), "#1245", "[compilation]") { TEST_CASE_METHOD((Fixture_1245<int, int>), "#1245", "[compilation]") {
SUCCEED(); SUCCEED();
} }
TEST_CASE("#1403", "[compilation]") {
::foo::helper_1403 h1, h2;
REQUIRE(h1 == h2);
}
}} // namespace CompilationTests }} // namespace CompilationTests