Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jarro2783/cxxopts.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/options.cpp')
-rw-r--r--test/options.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/options.cpp b/test/options.cpp
index eea0853..95cd220 100644
--- a/test/options.cpp
+++ b/test/options.cpp
@@ -94,7 +94,7 @@ TEST_CASE("Basic options", "[options]")
CHECK(arguments[2].key() == "value");
CHECK(arguments[3].key() == "av");
- CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::option_has_no_value_exception&);
+ CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::exceptions::option_has_no_value&);
CHECK(options.program() == "tester");
}
@@ -122,7 +122,7 @@ TEST_CASE("Short options", "[options]")
CHECK(arguments[0].value() == "value");
REQUIRE_THROWS_AS(options.add_options()("", "nothing option"),
- cxxopts::invalid_option_format_error&);
+ cxxopts::exceptions::invalid_option_format&);
}
TEST_CASE("No positional", "[positional]")
@@ -235,7 +235,7 @@ TEST_CASE("Positional not valid", "[positional]") {
auto** argv = av.argv();
auto argc = av.argc();
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::option_not_exists_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::no_such_option&);
}
TEST_CASE("Positional with empty arguments", "[positional]") {
@@ -294,7 +294,7 @@ TEST_CASE("Boolean without implicit value", "[implicit]")
auto** argv = av.argv();
auto argc = av.argc();
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::missing_argument_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::missing_argument&);
}
SECTION("With equal-separated true") {
@@ -460,7 +460,7 @@ TEST_CASE("Unsigned integers", "[options]")
auto argc = av.argc();
options.parse_positional("positional");
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::argument_incorrect_type&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::incorrect_argument_type&);
}
TEST_CASE("Integer bounds", "[integer]")
@@ -497,12 +497,12 @@ TEST_CASE("Overflow on boundary", "[integer]")
int8_t si;
uint8_t ui;
- CHECK_THROWS_AS((integer_parser("128", si)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("-129", si)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("256", ui)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("-0x81", si)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("0x80", si)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("0x100", ui)), cxxopts::argument_incorrect_type&);
+ CHECK_THROWS_AS((integer_parser("128", si)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("-129", si)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("256", ui)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("-0x81", si)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("0x80", si)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("0x100", ui)), cxxopts::exceptions::incorrect_argument_type&);
}
TEST_CASE("Integer overflow", "[options]")
@@ -519,11 +519,11 @@ TEST_CASE("Integer overflow", "[options]")
auto argc = av.argc();
options.parse_positional("positional");
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::argument_incorrect_type&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::incorrect_argument_type&);
int integer = 0;
- CHECK_THROWS_AS((integer_parser("23423423423", integer)), cxxopts::argument_incorrect_type&);
- CHECK_THROWS_AS((integer_parser("234234234234", integer)), cxxopts::argument_incorrect_type&);
+ CHECK_THROWS_AS((integer_parser("23423423423", integer)), cxxopts::exceptions::incorrect_argument_type&);
+ CHECK_THROWS_AS((integer_parser("234234234234", integer)), cxxopts::exceptions::incorrect_argument_type&);
}
TEST_CASE("Floats", "[options]")
@@ -564,7 +564,7 @@ TEST_CASE("Invalid integers", "[integer]") {
auto argc = av.argc();
options.parse_positional("positional");
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::argument_incorrect_type&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::incorrect_argument_type&);
}
TEST_CASE("Booleans", "[boolean]") {
@@ -670,7 +670,7 @@ TEST_CASE("Unrecognised options", "[options]") {
auto argc = av.argc();
SECTION("Default behaviour") {
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::option_not_exists_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::no_such_option&);
}
SECTION("After allowing unrecognised options") {
@@ -697,7 +697,7 @@ TEST_CASE("Allow bad short syntax", "[options]") {
auto argc = av.argc();
SECTION("Default behaviour") {
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::option_syntax_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::invalid_option_syntax&);
}
SECTION("After allowing unrecognised options") {
@@ -720,7 +720,7 @@ TEST_CASE("Invalid option syntax", "[options]") {
auto argc = av.argc();
SECTION("Default behaviour") {
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::option_syntax_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::invalid_option_syntax&);
}
}
@@ -739,7 +739,7 @@ TEST_CASE("Options empty", "[options]") {
auto** argv = argv_.argv();
CHECK(options.groups().empty());
- CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::option_not_exists_exception&);
+ CHECK_THROWS_AS(options.parse(argc, argv), cxxopts::exceptions::no_such_option&);
}
TEST_CASE("Initializer list with group", "[options]") {