Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-21 00:11:45 +0200
committerMartin Hořeňovský2019-09-21 00:50:17 +0200
commitfc2066bf18e4f20cc1609d1083adcfe3764866af (patch)
treef0d48142f03ada7aba246a8416aa6686e7f6b13a
parent2bcff9dd3581708d50734d3f55949146e5ba0162 (diff)
downloadcatch3-fc2066bf18e4f20cc1609d1083adcfe3764866af.tar.gz
Add tests for escaping special characters in CLI
-rw-r--r--projects/CMakeLists.txt3
-rw-r--r--projects/SelfTest/Baselines/compact.sw.approved.txt1
-rw-r--r--projects/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/console.sw.approved.txt12
-rw-r--r--projects/SelfTest/Baselines/junit.sw.approved.txt3
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt7
-rw-r--r--projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp5
7 files changed, 28 insertions, 7 deletions
diff --git a/projects/CMakeLists.txt b/projects/CMakeLists.txt
index 7105632b..0eb7cb56 100644
--- a/projects/CMakeLists.txt
+++ b/projects/CMakeLists.txt
@@ -429,6 +429,9 @@ set_tests_properties(LibIdentityTest PROPERTIES PASS_REGULAR_EXPRESSION "descrip
add_test(NAME FilenameAsTagsTest COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags)
set_tests_properties(FilenameAsTagsTest PROPERTIES PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]")
+add_test(NAME EscapeSpecialCharactersInTestNames COMMAND $<TARGET_FILE:SelfTest> "Test with special\\, characters \"in name")
+set_tests_properties(EscapeSpecialCharactersInTestNames PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case")
+
if (CATCH_USE_VALGRIND)
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
index 9a7abcef..03b49599 100644
--- a/projects/SelfTest/Baselines/compact.sw.approved.txt
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -1235,6 +1235,7 @@ Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15
Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15
VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions'
Tricky.tests.cpp:<line number>: passed: 0x<hex digits> == bit30and31 for: 3221225472 (0x<hex digits>) == 3221225472
+CmdLine.tests.cpp:<line number>: passed:
Message.tests.cpp:<line number>: failed - but was ok: 1 == 2
Misc.tests.cpp:<line number>: passed: with 1 message: 'oops!'
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'For some reason someone is throwing a string literal!'
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index d2b2165f..5798dcbe 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/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: 300 | 226 passed | 70 failed | 4 failed as expected
-assertions: 1568 | 1416 passed | 131 failed | 21 failed as expected
+test cases: 301 | 227 passed | 70 failed | 4 failed as expected
+assertions: 1569 | 1417 passed | 131 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index 6eabf307..b4aba834 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -9322,6 +9322,14 @@ with expansion:
3221225472 (0x<hex digits>) == 3221225472
-------------------------------------------------------------------------------
+Test with special, characters "in name
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>: PASSED:
+
+-------------------------------------------------------------------------------
The NO_FAIL macro reports a failure but does not fail the test
-------------------------------------------------------------------------------
Message.tests.cpp:<line number>
@@ -12520,6 +12528,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 300 | 210 passed | 86 failed | 4 failed as expected
-assertions: 1585 | 1416 passed | 148 failed | 21 failed as expected
+test cases: 301 | 211 passed | 86 failed | 4 failed as expected
+assertions: 1586 | 1417 passed | 148 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index e764d1f6..a768f1e6 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
- <testsuite name="<exe-name>" errors="17" failures="132" tests="1586" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1587" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
<property name="random-seed" value="1"/>
@@ -808,6 +808,7 @@ Misc.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/reserving smaller does not change size or capacity" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Test case with one argument" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Test enum bit values" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Test with special, characters &quot;in name" time="{duration}"/>
<testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}"/>
<testcase classname="<exe-name>.global" name="This test 'should' fail but doesn't" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Thrown string literals are translated" time="{duration}">
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index b58684d7..c4e5a75e 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -11269,6 +11269,9 @@ Message from section two
</Expression>
<OverallResult success="true"/>
</TestCase>
+ <TestCase name="Test with special, characters &quot;in name" tags="[cli][regression]" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
<TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Expression success="false" type="CHECK_NOFAIL" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
<Original>
@@ -14912,7 +14915,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1416" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1417" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1416" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1417" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index 6ecc3a14..60eb97af 100644
--- a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -506,3 +506,8 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
}
}
}
+
+TEST_CASE("Test with special, characters \"in name", "[cli][regression]") {
+ // This test case succeeds if we can invoke it from the CLI
+ SUCCEED();
+}