From 8f70dde82e942cf0d4e7332b6e8ae752b540cb0f Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Sat, 4 Nov 2023 15:20:47 -0500 Subject: [PATCH] Added unit test for mutex_args with three arguments --- test/test_mutually_exclusive_group.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test_mutually_exclusive_group.cpp b/test/test_mutually_exclusive_group.cpp index 493f58a..b1162e3 100644 --- a/test/test_mutually_exclusive_group.cpp +++ b/test/test_mutually_exclusive_group.cpp @@ -36,4 +36,19 @@ TEST_CASE( program_copy.parse_args({"test", "--first", "1", "--second", "2"}), "Argument '--second VAR' not allowed with '--first VAR'", std::runtime_error); +} + +TEST_CASE("Create mutually exclusive group with 3 arguments" * + test_suite("mutex_args")) { + argparse::ArgumentParser program("test"); + + auto &group = program.add_mutually_exclusive_group(); + group.add_argument("--first"); + group.add_argument("--second"); + group.add_argument("--third"); + + REQUIRE_THROWS_WITH_AS( + program.parse_args({"test", "--first", "1", "--third", "2"}), + "Argument '--third VAR' not allowed with '--first VAR'", + std::runtime_error); } \ No newline at end of file