-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes core dump on optional arg (issue #10)
- Loading branch information
Showing
3 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
#include <catch.hpp> | ||
#include <argparse.hpp> | ||
|
||
TEST_CASE("Parse unknown optional argument", "[compound_arguments]") { | ||
|
||
argparse::ArgumentParser bfm("bfm"); | ||
|
||
bfm.add_argument("-l","--load") | ||
.help("load a VMM into the kernel"); | ||
|
||
bfm.add_argument("-x", "--start") | ||
.default_value(false) | ||
.implicit_value(true) | ||
.help("start a previously loaded VMM"); | ||
|
||
bfm.add_argument("-d", "--dump") | ||
.default_value(false) | ||
.implicit_value(true) | ||
.help("output the contents of the VMM's debug buffer"); | ||
|
||
bfm.add_argument("-s", "--stop") | ||
.default_value(false) | ||
.implicit_value(true) | ||
.help("stop a previously started VMM"); | ||
|
||
bfm.add_argument("-u", "--unload") | ||
.default_value(false) | ||
.implicit_value(true) | ||
.help("unload a previously loaded VMM"); | ||
|
||
bfm.add_argument("-m", "--mem") | ||
.default_value(64ULL) | ||
.action([](const std::string& val) { return std::stoull(val); }) | ||
.help("memory in MB to give the VMM when loading"); | ||
|
||
bfm.parse_args({ "./test.exe", "-om" }); | ||
} |