You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

2 years ago
2 years ago
  1. #ifdef WITH_MODULE
  2. import argparse;
  3. #else
  4. #include <argparse/argparse.hpp>
  5. #endif
  6. #include <doctest.hpp>
  7. using doctest::test_suite;
  8. TEST_CASE("Parse unknown optional argument" *
  9. test_suite("compound_arguments")) {
  10. argparse::ArgumentParser bfm("bfm");
  11. bfm.add_argument("-l", "--load").help("load a VMM into the kernel");
  12. bfm.add_argument("-x", "--start")
  13. .default_value(false)
  14. .implicit_value(true)
  15. .help("start a previously loaded VMM");
  16. bfm.add_argument("-d", "--dump")
  17. .default_value(false)
  18. .implicit_value(true)
  19. .help("output the contents of the VMM's debug buffer");
  20. bfm.add_argument("-s", "--stop")
  21. .default_value(false)
  22. .implicit_value(true)
  23. .help("stop a previously started VMM");
  24. bfm.add_argument("-u", "--unload")
  25. .default_value(false)
  26. .implicit_value(true)
  27. .help("unload a previously loaded VMM");
  28. bfm.add_argument("-m", "--mem")
  29. .default_value(64ULL)
  30. .scan<'u', unsigned long long>()
  31. .help("memory in MB to give the VMM when loading");
  32. REQUIRE_THROWS_WITH_AS(bfm.parse_args({"./test.exe", "-om"}),
  33. "Unknown argument: -om", std::runtime_error);
  34. }