Class CommandLineArguments

Class Documentation

class CommandLineArguments
[source]

Parses and stores the mutiny command-line options.

Pass the raw argc/argv from main() to the constructor, then call parse() (optionally passing a Plugin chain for plugin-specific arguments). Query the resulting state with the is_*() and get_*() accessors. Used internally by CommandLineRunner.

Public Functions

explicit CommandLineArguments(int argc, const char *const *argv)

Construct from main’s argument list.

Parameters:
  • argc – Argument count.

  • argv – Argument vector.

virtual ~CommandLineArguments()
[source]
CommandLineArguments(const CommandLineArguments&) = delete
CommandLineArguments &operator=(const CommandLineArguments&) = delete
bool parse(Plugin *plugin)

Parse all arguments, delegating unknown ones to plugin.

Parameters:

pluginPlugin chain to receive unrecognised arguments; may be nullptr.

Returns:

true if parsing succeeded, false if an unrecognised argument was found.

bool need_help() const
Returns:

true if -h was passed.

bool is_verbose() const
Returns:

true if verbose output was requested (-v).

bool is_very_verbose() const
Returns:

true if very-verbose output was requested (-vv).

bool is_color() const
Returns:

true if coloured output was requested (-c).

bool is_listing_test_group_names() const
Returns:

true if -lg (list group names) was passed.

bool is_listing_test_group_and_case_names() const
Returns:

true if -ln (list group.case names) was passed.

bool is_listing_test_locations() const
Returns:

true if -ll (list test locations) was passed.

bool is_listing_ordered_test_locations() const
Returns:

true if -lo (list ordered test locations) was passed.

bool is_listing_test_group_locations() const
Returns:

true if -lgl (list group locations) was passed.

bool is_run_skipped() const
Returns:

true if -rs (run skipped tests) was passed.

unsigned int get_repeat_count() const
Returns:

The number of times to repeat the full test suite (-r N).

bool is_shuffling() const
Returns:

true if -s (shuffle) was passed.

bool is_reversing() const
Returns:

true if tests should run in reverse order (-rv).

bool is_crashing_on_fail() const
Returns:

true if the process should crash on first failure (-p).

bool is_rethrowing_exceptions() const
Returns:

true if exceptions should be re-thrown after being caught.

unsigned int get_shuffle_seed() const
Returns:

The seed used when shuffling (0 means time-seeded).

const Filter *get_group_filters() const
Returns:

The head of the group filter chain, or nullptr.

const Filter *get_name_filters() const
Returns:

The head of the name filter chain, or nullptr.

Public Static Functions

static String help()
[source]
Returns:

A formatted help string describing all supported arguments.