diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 8c7b9c57..6de24789 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -14,6 +14,7 @@ Nor would this :test-result: FAIL #1514: stderr/stdout is not captured in tests aborted by an exception :test-result: PASS #1548 :test-result: PASS #1905 -- test spec parser properly clears internal state between compound tests +:test-result: PASS #1912 -- test spec parser handles escaping :test-result: XFAIL #748 - captures with unexpected exceptions :test-result: PASS #809 :test-result: PASS #833 diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 914b4fb2..2a11bf78 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -27,6 +27,10 @@ Compilation.tests.cpp:: passed: std::is_same, TypeLis CmdLine.tests.cpp:: passed: spec.matches(*fakeTestCase("spec . char")) for: true CmdLine.tests.cpp:: passed: spec.matches(*fakeTestCase("spec , char")) for: true CmdLine.tests.cpp:: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +CmdLine.tests.cpp:: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +CmdLine.tests.cpp:: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +CmdLine.tests.cpp:: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +CmdLine.tests.cpp:: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' Exception.tests.cpp:: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:: passed: thisThrows() with 1 message: 'answer := 42' diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 4a51f82f..a0823854 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1380,6 +1380,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 333 | 259 passed | 70 failed | 4 failed as expected -assertions: 1876 | 1724 passed | 131 failed | 21 failed as expected +test cases: 334 | 260 passed | 70 failed | 4 failed as expected +assertions: 1880 | 1728 passed | 131 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index bb3c502e..0c022ebb 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -218,6 +218,40 @@ CmdLine.tests.cpp:: PASSED: with expansion: !false +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + Various parentheses +------------------------------------------------------------------------------- +CmdLine.tests.cpp: +............................................................................... + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) +with expansion: + true + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) +with expansion: + true + +CmdLine.tests.cpp:: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + backslash in test name +------------------------------------------------------------------------------- +CmdLine.tests.cpp: +............................................................................... + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) +with expansion: + true + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -14679,6 +14713,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 333 | 243 passed | 86 failed | 4 failed as expected -assertions: 1893 | 1724 passed | 148 failed | 21 failed as expected +test cases: 334 | 244 passed | 86 failed | 4 failed as expected +assertions: 1897 | 1728 passed | 148 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/console.swa4.approved.txt b/tests/SelfTest/Baselines/console.swa4.approved.txt index d35e1d7b..cf37da74 100644 --- a/tests/SelfTest/Baselines/console.swa4.approved.txt +++ b/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -218,6 +218,40 @@ CmdLine.tests.cpp:: PASSED: with expansion: !false +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + Various parentheses +------------------------------------------------------------------------------- +CmdLine.tests.cpp: +............................................................................... + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) +with expansion: + true + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) +with expansion: + true + +CmdLine.tests.cpp:: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + backslash in test name +------------------------------------------------------------------------------- +CmdLine.tests.cpp: +............................................................................... + +CmdLine.tests.cpp:: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) +with expansion: + true + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -398,6 +432,6 @@ Condition.tests.cpp:: FAILED: CHECK( true != true ) =============================================================================== -test cases: 21 | 16 passed | 3 failed | 2 failed as expected -assertions: 46 | 39 passed | 4 failed | 3 failed as expected +test cases: 22 | 17 passed | 3 failed | 2 failed as expected +assertions: 50 | 43 passed | 4 failed | 3 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index be4d8dde..ca65203f 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -32,6 +32,8 @@ Nor would this + + FAILED: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 80778cef..60357eb5 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -3,6 +3,8 @@ > + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index e7d76afd..a97aeb77 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -52,6 +52,14 @@ ok {test-number} - spec.matches(*fakeTestCase("spec . char")) for: true ok {test-number} - spec.matches(*fakeTestCase("spec , char")) for: true # #1905 -- test spec parser properly clears internal state between compound tests ok {test-number} - !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +# #1912 -- test spec parser handles escaping +ok {test-number} - !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec \ char)")) for: true # #748 - captures with unexpected exceptions not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' # #748 - captures with unexpected exceptions @@ -3778,5 +3786,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..1885 +1..1889 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 24dcd83b..116c80f9 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -30,6 +30,8 @@ Tricky.tests.cpp:|nexplicit failure with message:|n "1514"'] ##teamcity[testFinished name='#1548' duration="{duration}"] ##teamcity[testStarted name='#1905 -- test spec parser properly clears internal state between compound tests'] ##teamcity[testFinished name='#1905 -- test spec parser properly clears internal state between compound tests' duration="{duration}"] +##teamcity[testStarted name='#1912 -- test spec parser handles escaping'] +##teamcity[testFinished name='#1912 -- test spec parser handles escaping' duration="{duration}"] ##teamcity[testStarted name='#748 - captures with unexpected exceptions'] Exception.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] Exception.tests.cpp:|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 6f3b17d2..fbba5620 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -229,6 +229,47 @@ Nor would this + +
+ + + spec.matches(*fakeTestCase(R"(spec {a} char)")) + + + true + + + + + spec.matches(*fakeTestCase(R"(spec [a] char)")) + + + true + + + + + !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) + + + !false + + + +
+
+ + + spec.matches(*fakeTestCase(R"(spec \ char)")) + + + true + + + +
+ +
@@ -17595,7 +17636,7 @@ loose text artifact
- + - + diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index d78f8ac0..e8bf6e5f 100644 --- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -307,6 +307,24 @@ TEST_CASE("#1905 -- test spec parser properly clears internal state between comp REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)"))); } +TEST_CASE("#1912 -- test spec parser handles escaping", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + + SECTION("Various parentheses") { + TestSpec spec = parseTestSpec(R"(spec {a} char,spec \[a] char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec {a} char)"))); + REQUIRE(spec.matches(*fakeTestCase(R"(spec [a] char)"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))); + } + SECTION("backslash in test name") { + TestSpec spec = parseTestSpec(R"(spec \\ char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec \ char)"))); + } +} + TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { using namespace Catch::Matchers;