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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-10-23 00:09:17 +0200
committerMartin Hořeňovský2022-10-23 00:10:05 +0200
commita43f67962e632d9596680a7e139df9e0a1423d3a (patch)
tree2a4fd83a0d9a2d0adfdd5e9fff21b058f6f58d54 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parentf1361ef6243ec88038a6b4f013c405f2df3df376 (diff)
downloadcatch3-a43f67962e632d9596680a7e139df9e0a1423d3a.tar.gz
Refactor parsing of shard index/count in cmdline handling
This worsens the message for negative numbers a bit, but simplifies the code enough that this is still a win.
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index cbb0a988..abb873f2 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -649,14 +649,18 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") {
auto result = cli.parse({ "test", "--shard-count=-1" });
CHECK_FALSE(result);
- REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number"));
+ REQUIRE_THAT(
+ result.errorMessage(),
+ ContainsSubstring( "Could not parse '-1' as shard count" ) );
}
SECTION("Zero shard count reports error") {
auto result = cli.parse({ "test", "--shard-count=0" });
CHECK_FALSE(result);
- REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number"));
+ REQUIRE_THAT(
+ result.errorMessage(),
+ ContainsSubstring( "Shard count must be positive" ) );
}
SECTION("shard-index") {
@@ -669,7 +673,9 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") {
auto result = cli.parse({ "test", "--shard-index=-12" });
CHECK_FALSE(result);
- REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number"));
+ REQUIRE_THAT(
+ result.errorMessage(),
+ ContainsSubstring( "Could not parse '-12' as shard index" ) );
}
SECTION("Shard index 0 is accepted") {
@@ -677,7 +683,6 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") {
REQUIRE(config.shardIndex == 0);
}
-
}
TEST_CASE( "Parsing warnings", "[cli][warnings]" ) {