diff options
author | Eyal Rozenberg <eyalroz@technion.ac.il> | 2020-07-23 10:27:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 10:27:04 +0300 |
commit | 5f43f4cbfee5d92560ece7811a2a44c763f9fb73 (patch) | |
tree | 594e3458dfb13d3b81073217538a5992d97e73a7 /test | |
parent | 1b660d56801283905b0f0fdd43e7e7ba3c5c396e (diff) |
Fixes #245: Mention the option name when throwing on "no value" (#246)
* Fixes #245:
* Added a new exception type: `option_has_no_value_exception`; throwing it when an option has no value we can cast with `as()`, instead of an `std::domain_error`.
* The `OptionValue` type now holds a pointer to the long option name (in its corresponding key within ParseResults's `m_results` field.
Diffstat (limited to 'test')
-rw-r--r-- | test/options.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/options.cpp b/test/options.cpp index d3d3c7a..5026ea0 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>(), std::domain_error&); + CHECK_THROWS_AS(result["nothing"].as<std::string>(), cxxopts::option_has_no_value_exception&); } TEST_CASE("Short options", "[options]") |