Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/arg-parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }}
Expand Down
15 changes: 15 additions & 0 deletions test/framework/command-line-arguments.test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <cest>
#include <array>

describe("Cest command line options", []() {
it("will use default behaviour if empty", []() {
Expand Down Expand Up @@ -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<const char *, 2> long_argv = { "/bin/cest", "--tree-suite-result" };
std::array<const char *, 2> 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" };
Expand Down