diff --git a/src/arg-parser.hpp b/src/arg-parser.hpp index c4cc541..485d324 100644 --- a/src/arg-parser.hpp +++ b/src/arg-parser.hpp @@ -18,7 +18,7 @@ namespace cest {"-j", [&]() { options.json_output = true; }}, {"--only-suite-result", [&]() { options.only_test_suite_result = true; }}, {"-o", [&]() { options.only_test_suite_result = true; }}, - {"--tree-suite-result", [&]() { options.only_test_suite_result = true; }}, + {"--tree-suite-result", [&]() { options.tree_test_suite_result = true; }}, {"-t", [&]() { options.tree_test_suite_result = true; }}, {"--print-test-list", [&]() { options.print_test_list = true; }}, {"-l", [&]() { options.print_test_list = true; }} diff --git a/test/framework/command-line-arguments.test.cpp b/test/framework/command-line-arguments.test.cpp index 3795788..90310b1 100644 --- a/test/framework/command-line-arguments.test.cpp +++ b/test/framework/command-line-arguments.test.cpp @@ -1,4 +1,5 @@ #include +#include describe("Cest command line options", []() { it("will use default behaviour if empty", []() { @@ -104,6 +105,20 @@ describe("Cest command line options", []() { expect(options.json_output).toBe(true); }); + it("will use tree suite output for the long and short options", []() { + int argc = 2; + std::array long_argv = { "/bin/cest", "--tree-suite-result" }; + std::array short_argv = { "/bin/cest", "-t" }; + + auto long_options = cest::parseArgs(argc, long_argv.data()); + auto short_options = cest::parseArgs(argc, short_argv.data()); + + expect(long_options.tree_test_suite_result).toBe(true); + expect(long_options.only_test_suite_result).toBe(false); + expect(short_options.tree_test_suite_result).toBe(true); + expect(short_options.only_test_suite_result).toBe(false); + }); + it("will set filter when --grep is present", []() { int argc = 3; const char *argv[] = { "/bin/cest", "--grep", "booleans" };