Options: require output path to be non empty

This commit is contained in:
rr- 2016-03-16 13:08:02 +01:00
parent f726eaeb91
commit b5d2e03a7b
2 changed files with 4 additions and 0 deletions

View File

@ -56,6 +56,8 @@ Options opustags::parse_args(const int argc, char **argv)
break;
case 'o':
if (arg.empty())
throw ArgumentError("Output path cannot be empty");
options.path_out = arg;
break;

View File

@ -92,6 +92,8 @@ TEST_CASE("option parsing", "[options]")
SECTION("--output") {
REQUIRE(retrieve_options({"--output", "ABC"}).path_out == "ABC");
REQUIRE(retrieve_options({"-o", "ABC"}).path_out == "ABC");
REQUIRE_THROWS(retrieve_options({"--output", ""}));
REQUIRE_THROWS(retrieve_options({"-o", ""}));
}
SECTION("--delete-all") {