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:
authorTristan Stenner2020-02-15 20:42:57 +0100
committerMartin Hořeňovský2020-02-16 16:11:11 +0100
commit6a2c025bfc9fdac3d99e6f54c790bc04d0ca8174 (patch)
treefed92cba0c89083a7f689dd9c0c4894579a1c968 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parent2441c2faab1a4f7bbd087d38027d087b303ea989 (diff)
downloadcatch3-6a2c025bfc9fdac3d99e6f54c790bc04d0ca8174.tar.gz
Add command line option 'never' to --wait-for-keypress (#1866)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index b7d5c9c2..2d62e9e1 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -10,6 +10,7 @@
#include <catch2/catch_test_case_info.h>
#include <catch2/catch_config.hpp>
#include <catch2/catch_commandline.h>
+#include <catch2/catch_generators.hpp>
#ifdef __clang__
# pragma clang diagnostic ignored "-Wc++98-compat"
@@ -410,7 +411,31 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
CHECK(!result);
REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
}
+
+ SECTION("wait-for-keypress") {
+ SECTION("Accepted options") {
+ using tuple_type = std::tuple<char const*, Catch::WaitForKeypress::When>;
+ auto input = GENERATE(table<char const*, Catch::WaitForKeypress::When>({
+ tuple_type{"never", Catch::WaitForKeypress::Never},
+ tuple_type{"start", Catch::WaitForKeypress::BeforeStart},
+ tuple_type{"exit", Catch::WaitForKeypress::BeforeExit},
+ tuple_type{"both", Catch::WaitForKeypress::BeforeStartAndExit},
+ }));
+ CHECK(cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}));
+
+ REQUIRE(config.waitForKeypress == std::get<1>(input));
+ }
+
+ SECTION("invalid options are reported") {
+ auto result = cli.parse({"test", "--wait-for-keypress", "sometimes"});
+ CHECK(!result);
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both"));
+#endif
+ }
}
+ }
SECTION("nothrow") {
SECTION("-e") {