Fix passing a const array to parse (#258)

Fixes #257. The input array is not modified, so we can declare this as
`char const* const*`.
This commit is contained in:
jarro2783
2020-10-03 20:54:06 +10:00
committed by GitHub
parent 4b63c333a8
commit 3ef9fddc7b
2 changed files with 12 additions and 6 deletions
+6
View File
@@ -773,3 +773,9 @@ TEST_CASE("Option add with add_option(string, Option)", "[options]") {
CHECK(result["aggregate"].as<int>() == 4);
CHECK(result["test"].as<int>() == 5);
}
TEST_CASE("Const array", "[const]") {
const char* const option_list[] = {"empty", "options"};
cxxopts::Options options("Empty options", " - test constness");
auto result = options.parse(2, option_list);
}