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

summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-09-27 14:52:44 +0200
committerMartin Hořeňovský2021-09-27 14:55:28 +0200
commitd42e7a23a0ca942e73b7065a1fbf28b6b2a817ce (patch)
treedd25a53f6dbd98a36b2aaf1b1f3b4fa31e55df1c /tests
parent7bb00a42be5195f30b10b944c275c746e446810c (diff)
downloadcatch3-d42e7a23a0ca942e73b7065a1fbf28b6b2a817ce.tar.gz
Change startsWith(char) to take StringRef as argument
Diffstat (limited to 'tests')
-rw-r--r--tests/SelfTest/Baselines/automake.sw.approved.txt1
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt3
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt25
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt3
-rw-r--r--tests/SelfTest/Baselines/sonarqube.sw.approved.txt1
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/teamcity.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt31
-rw-r--r--tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp8
10 files changed, 78 insertions, 8 deletions
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt
index 5d599b6e..7b401531 100644
--- a/tests/SelfTest/Baselines/automake.sw.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.approved.txt
@@ -330,6 +330,7 @@ loose text artifact
:test-result: PASS shortened hide tags are split apart
:test-result: PASS splitString
:test-result: FAIL stacks unscoped info in loops
+:test-result: PASS startsWith
:test-result: PASS std::map is convertible string
:test-result: PASS std::pair<int,const std::string> -> toString
:test-result: PASS std::pair<int,std::string> -> toString
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 556db261..1813ff3c 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -2224,6 +2224,9 @@ StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
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'
+StringManip.tests.cpp:<line number>: passed: !(startsWith("", 'c')) for: !false
+StringManip.tests.cpp:<line number>: passed: startsWith(std::string("abc"), 'a') for: true
+StringManip.tests.cpp:<line number>: passed: startsWith("def"_catch_sr, 'd') for: true
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 ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index 8704f8b3..13b39435 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1386,6 +1386,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
-test cases: 368 | 292 passed | 70 failed | 6 failed as expected
-assertions: 2103 | 1951 passed | 129 failed | 23 failed as expected
+test cases: 369 | 293 passed | 70 failed | 6 failed as expected
+assertions: 2106 | 1954 passed | 129 failed | 23 failed as expected
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index 08cef9ac..ba1d14c9 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -15856,6 +15856,27 @@ with messages:
6
-------------------------------------------------------------------------------
+startsWith
+-------------------------------------------------------------------------------
+StringManip.tests.cpp:<line number>
+...............................................................................
+
+StringManip.tests.cpp:<line number>: PASSED:
+ CHECK_FALSE( startsWith("", 'c') )
+with expansion:
+ !false
+
+StringManip.tests.cpp:<line number>: PASSED:
+ CHECK( startsWith(std::string("abc"), 'a') )
+with expansion:
+ true
+
+StringManip.tests.cpp:<line number>: PASSED:
+ CHECK( startsWith("def"_catch_sr, 'd') )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
std::map is convertible string
empty
-------------------------------------------------------------------------------
@@ -16933,6 +16954,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
-test cases: 368 | 276 passed | 86 failed | 6 failed as expected
-assertions: 2120 | 1951 passed | 146 failed | 23 failed as expected
+test cases: 369 | 277 passed | 86 failed | 6 failed as expected
+assertions: 2123 | 1954 passed | 146 failed | 23 failed as expected
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index 88e96b0f..f6285201 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/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="129" tests="2120" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="129" tests="2123" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
@@ -1756,6 +1756,7 @@ Count 4 to 6...
Message.tests.cpp:<line number>
</failure>
</testcase>
+ <testcase classname="<exe-name>.global" name="startsWith" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::map is convertible string/empty" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::map is convertible string/single item" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::map is convertible string/several items" time="{duration}" status="run"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
index 924a14b1..c95948c3 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -215,6 +215,7 @@
<testCase name="replaceInPlace/replace no chars" duration="{duration}"/>
<testCase name="replaceInPlace/escape '" duration="{duration}"/>
<testCase name="splitString" duration="{duration}"/>
+ <testCase name="startsWith" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp">
<testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index 724cd499..a82febac 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -4004,6 +4004,12 @@ ok {test-number} - splitStringRef("abc,def", ','), Equals(std::vector<StringRef>
not ok {test-number} - false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
# stacks unscoped info in loops
not ok {test-number} - false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
+# startsWith
+ok {test-number} - !(startsWith("", 'c')) for: !false
+# startsWith
+ok {test-number} - startsWith(std::string("abc"), 'a') for: true
+# startsWith
+ok {test-number} - startsWith("def"_catch_sr, 'd') for: true
# std::map is convertible string
ok {test-number} - Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
# std::map is convertible string
@@ -4242,5 +4248,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..2120
+1..2123
diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
index 5291c85d..3867ec4a 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
@@ -803,6 +803,8 @@ Message.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i
Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n']
Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n']
##teamcity[testFinished name='stacks unscoped info in loops' duration="{duration}"]
+##teamcity[testStarted name='startsWith']
+##teamcity[testFinished name='startsWith' duration="{duration}"]
##teamcity[testStarted name='std::map is convertible string']
##teamcity[testFinished name='std::map is convertible string' duration="{duration}"]
##teamcity[testStarted name='std::pair<int,const std::string> -> toString']
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index bd12e70a..917010be 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -18761,6 +18761,33 @@ loose text artifact
</Expression>
<OverallResult success="false"/>
</TestCase>
+ <TestCase name="startsWith" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
+ <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
+ <Original>
+ !(startsWith("", 'c'))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
+ <Original>
+ startsWith(std::string("abc"), 'a')
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" >
+ <Original>
+ startsWith("def"_catch_sr, 'd')
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
<TestCase name="std::map is convertible string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
@@ -19926,6 +19953,6 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1951" failures="146" expectedFailures="23"/>
- <OverallResultsCases successes="276" failures="86" expectedFailures="6"/>
+ <OverallResults successes="1954" failures="146" expectedFailures="23"/>
+ <OverallResultsCases successes="277" failures="86" expectedFailures="6"/>
</Catch2TestRun>
diff --git a/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp b/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp
index d78567ca..ad274939 100644
--- a/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp
@@ -65,3 +65,11 @@ TEST_CASE("splitString", "[string-manip]") {
CHECK_THAT(splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}));
CHECK_THAT(splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}));
}
+
+TEST_CASE("startsWith", "[string-manip]") {
+ using Catch::startsWith;
+
+ CHECK_FALSE(startsWith("", 'c'));
+ CHECK(startsWith(std::string("abc"), 'a'));
+ CHECK(startsWith("def"_catch_sr, 'd'));
+}