micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::runner_options Class Reference

The configuration of a test session, and its command-line parser. More...

#include "micro-os-plus/micro-test-plus.h"

Public Member Functions

 runner_options (const runner_options &other)=default
 Copy constructor.
 runner_options (int argc, char *argv[])
 Constructs the options by parsing the command line.
 runner_options (runner_options &&other)=default
 Move constructor.
 runner_options (void)=default
 Constructs the default options.
 ~runner_options ()=default
 Destructor.
std::span< const std::string > application_arguments (void) const noexcept
 Returns the arguments left to the application.
const std::vector< std::string > & arguments (void) const noexcept
 Returns the complete command line, including argv[0], if any.
const std::vector< std::string > & errors (void) const noexcept
 Returns the errors found while parsing the command line.
bool has_errors (void) const noexcept
 Checks whether errors were found while parsing the command line.
bool has_unknown_option (void) const noexcept
 Checks whether an unknown option was found while parsing the command line.
runner_options & operator= (const runner_options &other)
 Copy assignment operator.
runner_options & operator= (runner_options &&other)=default
 Move assignment operator.

Public Attributes

colour_mode colour { colour_mode::automatic }
 Whether the console output uses colours.
std::vector< std::string > filter_patterns {}
 The patterns that select the suites and the test cases to run, one per nesting level.
bool help { false }
 Whether to display the usage and the list of the options, instead of running the tests.
bool list_tests { false }
 Whether the test cases are listed instead of run.
std::string output_file_path {}
 Path of the optional output file.
reporter_kind selected_reporter { reporter_kind::tap }
 The reporter that displays the results.
micro_test_plus::verbosity verbosity_level
 The level of detail of the console output.

Private Member Functions

void add_error (std::string_view before, std::string_view value={}, std::string_view after={})
 Records a command-line error.

Private Attributes

std::size_t application_begin_ { 0 }
 The index in arguments_ of the first argument left to the application.
std::vector< std::string > arguments_ {}
 The complete command line, including argv[0], if any.
std::vector< std::string > errors_ {}
 The errors found while parsing the command line.
bool unknown_option_ { false }
 Whether an unknown option was found.

Detailed Description

The options are usually constructed from the command line, by runner::initialise (argc, argv), which creates the selected reporter and starts the session:

tr.initialise (argc, argv);

The applications that do not have a command line, such as the embedded ones without semihosting arguments, can define the options directly, starting from the defaults:

mt::runner_options options{};
options.selected_reporter = mt::reporter_kind::human;
options.verbosity_level = mt::verbosity::verbose;
tr.initialise (options);

The applications can also parse the command line themselves, and adjust the result before passing it to the runner:

mt::runner_options options{ argc, argv };
options.list_tests = true;
tr.initialise (options);

The configuration members are public, since any combination of their values is valid; the command line and the results of the parsing (whether errors were found, whether an unknown option was found, and where the application arguments start) are private, since they depend on one another, and are read with the accessors.

The options own their strings (the command line, the path of the output file, and the filter patterns), so they do not depend on the lifetime of the caller's strings; the runner keeps its own copy of them.

Since
6.0.0

Definition at line 217 of file runner-options.h.

Constructor & Destructor Documentation

◆ runner_options() [1/4]

micro_os_plus::micro_test_plus::runner_options::runner_options ( void )
default

The TAP reporter, the normal verbosity, no output file, automatic colours, no filter, and no command line; the test cases are run, not listed.

Referenced by runner_options(), runner_options(), operator=(), and operator=().

◆ runner_options() [2/4]

micro_os_plus::micro_test_plus::runner_options::runner_options ( int argc,
char * argv[] )
explicit

Starts from the defaults, and parses the µTest++ options (--reporter, --silent, --quiet, --verbose, --output-file, --colour, --color, --use-colour, --use-color, --filter, --list-tests, --list, --help, and -h). The parsing ends at the first argument that does not start with a dash (an application argument), or at the first -- alone; that argument, and all the following ones, are left to the application, and are available from application_arguments(). An option argument given separately (--reporter human) belongs to its option and does not end the parsing. Before that point, the arguments starting with a dash that are not µTest++ options are reported as unknown options; an application that receives such arguments first must precede them with --.

A missing option argument, an unknown reporter name, an unknown colour mode, a colour mode given separately after --colour or --color, or an unknown option, is recorded in errors(), and makes has_errors() true; the constructor writes nothing. The parsing continues, to record all the errors, but runner::initialise() then runs no test: it writes the errors on stderr, on the console, and in the output file, if any, followed, for an unknown option, by a line suggesting --help, and run_suites() returns 2.

The argv[] strings are copied, so they need not outlive the options.

Parameters
argcThe argument count from main().
argvThe argument vector from main().
Since
6.0.0

Scans the arguments after argv[0], in order, for:

  • --reporter=<name> or --reporter <name>, with tap (the default) or human;
  • --verbose, --quiet, and --silent;
  • --output-file=<path> or --output-file <path>;
  • --colour[=<when>], or its American spelling --color[=<when>], as in the GNU tools, with always, never, or auto (the default), and their GNU synonyms (yes and force, no and none, tty and if-tty); --colour alone means always;
  • --use-colour=<mode> or --use-colour <mode>, or the American spelling --use-color, the Catch2 and Boost UT alternative to --colour, with yes, no, or auto, or any of the --colour values;
  • --filter=<pattern> or --filter <pattern>;
  • --list-tests, or its short form --list, as in Catch2 and Boost UT, to list the test cases instead of running them;
  • --help, or its short form -h, to display the usage instead of running the tests.

When an option is repeated, the last one takes effect, except --filter, whose patterns are all kept, in order, one per nesting level; --colour, --color, --use-colour, and --use-color set the same option. An option argument given separately is the next argument, whatever its content; --colour and --color accept their value only after =.

The parsing ends at the first argument that does not start with a dash, or at the first -- alone; the arguments from there on are left to the application, and are not interpreted, so they can be options of the application. The -- itself is not an application argument. An argument that starts with a dash, before that point, and is not a µTest++ option, is reported as an unknown option. The whole command line is copied into arguments_, to be listed by the reporter; the option values are copied from there.

A missing option argument, an unknown reporter name, an unknown colour mode, a colour mode given separately after --colour or --color, or an unknown option (any other argument that starts with a dash, including a single one), is recorded by add_error(), and the option is ignored; the parsing continues with the next argument, to record all the errors. Nothing is written by the constructor; the runner then writes the errors and refuses to run the tests.

Definition at line 119 of file runner-options.cpp.

120 {
121#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED)
122 trace::printf ("%s\n", __PRETTY_FUNCTION__);
123#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_ENABLED
124
125 if (argc <= 0 || argv == nullptr)
126 {
127 return;
128 }
129
130 // Copy the strings one by one, since the vector assignment uses
131 // std::copy, which triggers -Waggregate-return in the standard library
132 // headers on some targets.
133 arguments_.reserve (static_cast<size_t> (argc));
134 for (int i = 0; i < argc; ++i)
135 {
136 arguments_.emplace_back (argv[i] != nullptr ? argv[i] : "");
137 }
138
139 // Unless the parsing stops earlier, there are no application arguments.
141
142 // What an option with a value sets.
143 enum class setting
144 {
145 set_reporter,
146 set_output_file,
147 set_colour,
148 add_filter
149 };
150
151 // The options with a value, which is given as `--option=<value>`,
152 // or, if `value_may_follow`, also as `--option <value>`. As in the GNU
153 // tools, `--colour` and `--color` alone mean `always`, and the next
154 // argument is never taken as their value.
155#if defined(__GNUC__)
156#pragma GCC diagnostic push
157
158#pragma GCC diagnostic ignored "-Wpadded"
159#endif // defined(__GNUC__)
160
161 struct value_option
162 {
163 std::string_view name;
164 setting what;
165 bool value_may_follow;
166 };
167
168#if defined(__GNUC__)
169#pragma GCC diagnostic pop
170#endif // defined(__GNUC__)
171
172 static constexpr value_option value_options[]
173 = { { "--reporter", setting::set_reporter, true },
174 { "--output-file", setting::set_output_file, true },
175 { "--use-colour", setting::set_colour, true },
176 { "--use-color", setting::set_colour, true },
177 { "--colour", setting::set_colour, false },
178 { "--color", setting::set_colour, false },
179 { "--filter", setting::add_filter, true } };
180
181 // Set the colour mode from the value of `--colour`, `--color`,
182 // `--use-colour`, or `--use-color`; all accept the values and the
183 // synonyms of the GNU tools, which include those of Catch2 and Boost
184 // UT (`yes`, `no`, and `auto`). An unknown mode is reported as an
185 // error.
186 auto set_colour_mode = [&] (std::string_view value)
187 {
188 if (value == "always" || value == "yes" || value == "force")
189 {
191 }
192 else if (value == "never" || value == "no" || value == "none")
193 {
195 }
196 else if (value == "auto" || value == "tty" || value == "if-tty")
197 {
199 }
200 else
201 {
202 add_error ("unknown colour mode '", value, "'");
203 }
204 };
205
206 // Whether an argument is a value of `--colour`, to detect a value
207 // given separately, which the option does not take.
208 auto is_colour_mode = [] (std::string_view value) -> bool
209 {
210 for (const std::string_view mode :
211 { "always", "yes", "force", "never", "no", "none", "auto", "tty",
212 "if-tty" })
213 {
214 if (value == mode)
215 {
216 return true;
217 }
218 }
219 return false;
220 };
221
222 // Apply the value of an option with a value; an invalid value is
223 // reported as an error.
224 auto apply_value = [&] (setting what, std::string_view value)
225 {
226 if (what == setting::set_reporter)
227 {
228 if (value == "human")
229 {
231 }
232 else if (value == "tap")
233 {
235 }
236 else
237 {
238 add_error ("unknown reporter '", value, "'");
239 }
240 }
241 else if (what == setting::set_output_file)
242 {
243 // An empty path disables the output file.
244 output_file_path = value;
245 }
246 else if (what == setting::set_colour)
247 {
248 set_colour_mode (value);
249 }
250 else
251 {
252 filter_patterns.emplace_back (value);
253 }
254 };
255
256 for (size_t i = 1; i < arguments_.size (); ++i)
257 {
258 const std::string_view argument{ arguments_[i] };
259
260 // The application arguments start at the first argument that does
261 // not start with a dash, or after the first `--` alone.
262 if (argument == "--")
263 {
264 application_begin_ = i + 1;
265 break;
266 }
267 if (!argument.starts_with ('-'))
268 {
270 break;
271 }
272
273 if (argument == "--verbose")
274 {
276 continue;
277 }
278 if (argument == "--quiet")
279 {
281 continue;
282 }
283 if (argument == "--silent")
284 {
286 continue;
287 }
288 if (argument == "--list-tests" || argument == "--list")
289 {
290 list_tests = true;
291 continue;
292 }
293 if (argument == "--help" || argument == "-h")
294 {
295 help = true;
296 continue;
297 }
298
299 // Match the options with a value, alone or followed by `=`.
300 const value_option* matched = nullptr;
301 bool has_inline_value = false;
302 std::string_view value{};
303 for (const value_option& option : value_options)
304 {
305 if (argument == option.name)
306 {
307 matched = &option;
308 break;
309 }
310 if (argument.starts_with (option.name)
311 && argument.substr (option.name.size ()).starts_with ('='))
312 {
313 matched = &option;
314 has_inline_value = true;
315 value = argument.substr (option.name.size () + 1);
316 break;
317 }
318 }
319
320 if (matched == nullptr)
321 {
322 // A mistyped option must not silently disable the tests.
323 add_error ("unknown option '", argument, "'");
324 unknown_option_ = true;
325 continue;
326 }
327
328 if (!has_inline_value)
329 {
330 if (!matched->value_may_follow)
331 {
332 // The option alone means `always`. If the next argument
333 // looks like a mode, it was probably meant to be the
334 // value, so report it instead of silently passing it to
335 // the application.
337 if (i + 1 < arguments_.size ()
338 && is_colour_mode (arguments_[i + 1]))
339 {
340 std::string text{ "'" };
341 text.append (argument);
342 text.append ("' takes its value only after '='; write '");
343 text.append (argument);
344 text.append ("=");
345 text.append (arguments_[i + 1]);
346 text.append (
347 "', or put '--' before the application argument");
348 add_error (text);
349 }
350 continue;
351 }
352
353 if (i + 1 >= arguments_.size ())
354 {
355 add_error ("", matched->name, " option requires an argument");
356 continue;
357 }
358 value = arguments_[++i];
359 }
360
361 apply_value (matched->what, value);
362 }
363 }
std::size_t application_begin_
The index in arguments_ of the first argument left to the application.
bool help
Whether to display the usage and the list of the options, instead of running the tests.
colour_mode colour
Whether the console output uses colours.
std::vector< std::string > filter_patterns
The patterns that select the suites and the test cases to run, one per nesting level.
bool unknown_option_
Whether an unknown option was found.
std::string output_file_path
Path of the optional output file.
void add_error(std::string_view before, std::string_view value={}, std::string_view after={})
Records a command-line error.
bool list_tests
Whether the test cases are listed instead of run.
reporter_kind selected_reporter
The reporter that displays the results.
std::vector< std::string > arguments_
The complete command line, including argv[0], if any.
micro_test_plus::verbosity verbosity_level
The level of detail of the console output.

References add_error(), micro_os_plus::micro_test_plus::always, application_begin_, arguments_, micro_os_plus::micro_test_plus::automatic, colour, filter_patterns, help, micro_os_plus::micro_test_plus::human, list_tests, micro_os_plus::micro_test_plus::never, output_file_path, micro_os_plus::micro_test_plus::quiet, selected_reporter, micro_os_plus::micro_test_plus::silent, micro_os_plus::micro_test_plus::tap, unknown_option_, micro_os_plus::micro_test_plus::verbose, and verbosity_level.

◆ runner_options() [3/4]

micro_os_plus::micro_test_plus::runner_options::runner_options ( const runner_options & other)
default

Copies all the members, including the strings and the results of the parsing, so the copy initialises a runner exactly as the original does; the copy is independent of the original.

Parameters
otherThe instance to copy.
Since
6.0.0

References runner_options().

◆ runner_options() [4/4]

micro_os_plus::micro_test_plus::runner_options::runner_options ( runner_options && other)
default

Moves the strings and the vectors, and copies the other members; other is left valid, with unspecified strings.

Parameters
otherThe instance to move from.
Since
6.0.0

References runner_options().

◆ ~runner_options()

micro_os_plus::micro_test_plus::runner_options::~runner_options ( )
default

Releases the owned strings.

Member Function Documentation

◆ add_error()

void micro_os_plus::micro_test_plus::runner_options::add_error ( std::string_view before,
std::string_view value = {},
std::string_view after = {} )
private

Appends the text to errors_; nothing is written, so that parsing the command line has no output.

Parameters
beforeThe start of the message, without the error: prefix.
valueThe variable part, usually an option or a value.
afterThe end of the message, without the newline.
Returns
Nothing.

The message is only kept in errors_, so that the constructor has no output; the runner writes it on stderr and on the console, since the reporter does not exist yet.

Definition at line 376 of file runner-options.cpp.

378 {
379 std::string text{ before };
380 text.append (value);
381 text.append (after);
382
383 errors_.push_back (std::move (text));
384 }
std::vector< std::string > errors_
The errors found while parsing the command line.

References errors_.

Referenced by runner_options().

◆ application_arguments()

std::span< const std::string > micro_os_plus::micro_test_plus::runner_options::application_arguments ( void ) const
inlinenodiscardnoexcept

The arguments that follow the µTest++ options on the command line: the first argument that does not start with a dash, if the parsing ended there, and all the following ones, unchanged, or, if the parsing ended at a -- alone, the arguments after it, which may start with --. The -- itself and argv[0] are not included. The span refers to the command line, so it is valid as long as the options are not modified or destroyed.

Parameters
None.
Returns
A span of the arguments; empty if there are none, or if the options were not parsed from a command line.
Since
6.0.0

Returns the part of arguments_ that starts at application_begin_, or an empty span if there are none, including when the options were not parsed from a command line.

Definition at line 117 of file runner-options-inlines.h.

118 {
119 if (application_begin_ >= arguments_.size ())
120 {
121 return {};
122 }
123
124 return std::span<const std::string>{ arguments_ }.subspan (
126 }

References application_begin_, and arguments_.

◆ arguments()

const std::vector< std::string > & micro_os_plus::micro_test_plus::runner_options::arguments ( void ) const
inlinenodiscardnoexcept

A copy of the argv[] strings of main(), set when the options are parsed from the command line; empty for the default options. When not empty, the reporters list it at the beginning of the report, and runner::add_top_suite() derives the default name of the top suite from its first element. The arguments left to the application are returned by application_arguments().

The command line is read-only, since application_arguments() depends on the position where the parsing ended, which would be stale if the strings were changed afterwards.

Parameters
None.
Returns
A reference to the strings; empty if the options were not parsed from a command line.
Since
6.0.0

Returns the member arguments_, which is filled only by the parsing constructor.

Definition at line 105 of file runner-options-inlines.h.

106 {
107 return arguments_;
108 }

References arguments_.

Referenced by micro_os_plus::micro_test_plus::runner::add_top_suite(), micro_os_plus::micro_test_plus::detail::reporter_human::begin_session(), micro_os_plus::micro_test_plus::detail::reporter_tap::begin_session(), and micro_os_plus::micro_test_plus::runner::initialise().

◆ errors()

const std::vector< std::string > & micro_os_plus::micro_test_plus::runner_options::errors ( void ) const
inlinenodiscardnoexcept

Each message is the text of the error, without the error: prefix and the newline, in the order of the arguments. The runner writes them on stderr and on the console when it refuses to run the tests.

Parameters
None.
Returns
A reference to the messages; empty if there were no errors.
Since
6.0.0

Returns the errors_ member.

Definition at line 94 of file runner-options-inlines.h.

95 {
96 return errors_;
97 }

References errors_.

Referenced by micro_os_plus::micro_test_plus::runner::initialise().

◆ has_errors()

bool micro_os_plus::micro_test_plus::runner_options::has_errors ( void ) const
inlinenodiscardnoexcept

The constructor only records the errors; when set, the runner runs no test and runner::run_suites() returns 2. Never set for the default options.

Parameters
None.
Returns
true if at least one error was found.
Since
6.0.0

Returns whether the errors_ member is not empty.

Definition at line 74 of file runner-options-inlines.h.

75 {
76 return !errors_.empty ();
77 }

References errors_.

Referenced by micro_os_plus::micro_test_plus::runner::initialise().

◆ has_unknown_option()

bool micro_os_plus::micro_test_plus::runner_options::has_unknown_option ( void ) const
inlinenodiscardnoexcept

Set together with the corresponding error; the runner then adds a line suggesting --help to the errors it writes on the console.

Parameters
None.
Returns
true if at least one unknown option was found.
Since
6.0.0

Returns the unknown_option_ member.

Definition at line 84 of file runner-options-inlines.h.

85 {
86 return unknown_option_;
87 }

References unknown_option_.

Referenced by micro_os_plus::micro_test_plus::runner::initialise().

◆ operator=() [1/2]

runner_options & micro_os_plus::micro_test_plus::runner_options::operator= ( const runner_options & other)
inline

Replaces all the members with copies of those of other.

Not defaulted: it copies other with the copy constructor, and moves the copy into this instance, since the copy assignment of the vectors of strings uses std::copy, which triggers -Waggregate-return in the standard library headers of GCC on some targets. If the copy fails, this instance is not changed.

Parameters
otherThe instance to copy.
Returns
Reference to this instance.
Since
6.0.0

Copies other with the copy constructor, and moves the copy into this instance; self-assignment is safe.

Definition at line 62 of file runner-options-inlines.h.

63 {
64 runner_options copy{ other };
65 *this = std::move (copy);
66 return *this;
67 }
runner_options(void)=default
Constructs the default options.

References runner_options().

◆ operator=() [2/2]

runner_options & micro_os_plus::micro_test_plus::runner_options::operator= ( runner_options && other)
default

Moves the strings and the vectors, and copies the other members.

Parameters
otherThe instance to move from.
Returns
Reference to this instance.
Since
6.0.0

References runner_options().

Member Data Documentation

◆ application_begin_

std::size_t micro_os_plus::micro_test_plus::runner_options::application_begin_ { 0 }
private

Set by the parsing constructor, where the parsing of the µTest++ options ends; used by application_arguments().

Definition at line 629 of file runner-options.h.

Referenced by runner_options(), and application_arguments().

◆ arguments_

std::vector<std::string> micro_os_plus::micro_test_plus::runner_options::arguments_ {}
private

Filled by the parsing constructor with a copy of the argv[] strings; returned by arguments(), and used by application_arguments().

Definition at line 619 of file runner-options.h.

Referenced by runner_options(), application_arguments(), and arguments().

◆ colour

colour_mode micro_os_plus::micro_test_plus::runner_options::colour { colour_mode::automatic }

Set by --colour[=<when>], or by its American spelling --color[=<when>], as in the GNU tools, where <when> is always, never, or auto, or one of their GNU synonyms (yes and force, no and none, tty and if-tty), and --colour alone means always; the value is accepted only after =, and a mode word in the next argument, such as --colour never, is reported as an error, since it was probably meant as the value (an application argument of that kind can follow --). The alternative --use-colour=<mode> or --use-colour <mode>, also spelled --use-color, as in Catch2 and Boost UT, takes yes, no, or auto, and also accepts the other values of --colour. Used only by the human-readable reporter.

Since
6.0.0

Definition at line 389 of file runner-options.h.

Referenced by micro_os_plus::micro_test_plus::detail::reporter_human::reporter_human(), and runner_options().

◆ errors_

std::vector<std::string> micro_os_plus::micro_test_plus::runner_options::errors_ {}
private

Appended by add_error(); returned by errors(), and tested by has_errors().

Definition at line 600 of file runner-options.h.

Referenced by add_error(), errors(), and has_errors().

◆ filter_patterns

std::vector<std::string> micro_os_plus::micro_test_plus::runner_options::filter_patterns {}

Each --filter=<pattern> or --filter <pattern> option adds one pattern; unlike the other options, --filter may be repeated. As with --grep in node-tap, the first pattern applies to the suite names, the second to the names of the test cases, and each further pattern to the names of the test cases nested one level deeper; the levels without a pattern are not filtered.

Within a pattern, | separates alternatives; a name matches when it matches any of them, as defined by utility::is_match(): * matches any sequence of characters, ? matches any single character, the match is case-sensitive, and the alternative must cover the whole name.

The suites and the test cases that do not match are reported as skipped, and their bodies are not called. The top suite is never skipped as a whole, since its body is main(), but when its name does not match the first pattern, all its test cases are skipped.

When the list is empty (the default), everything runs.

Since
6.0.0

Definition at line 418 of file runner-options.h.

Referenced by runner_options(), micro_os_plus::micro_test_plus::runner::initialise(), micro_os_plus::micro_test_plus::runner::is_selected(), and micro_os_plus::micro_test_plus::runner::run_suites().

◆ help

bool micro_os_plus::micro_test_plus::runner_options::help { false }

Set by the --help option, or by its short form -h, which is the only short option. The runner then writes, on the console, the usage and the list of the options, runs no test, creates no output file, and run_suites() returns 0, or 2 after an option error. The text is written also with the silent verbosity, since it was requested.

Since
6.0.0

Definition at line 471 of file runner-options.h.

Referenced by runner_options(), micro_os_plus::micro_test_plus::detail::runnable_base::accepts_test_case(), micro_os_plus::micro_test_plus::runner::add_top_suite(), micro_os_plus::micro_test_plus::detail::runnable_base::after_test_case_create(), and micro_os_plus::micro_test_plus::runner::initialise().

◆ list_tests

bool micro_os_plus::micro_test_plus::runner_options::list_tests { false }

Set by the --list-tests option, or by its short form --list. When set, the suite bodies run, as usual, to create their test cases, but the bodies of the test cases do not, so no check is evaluated. The selected test cases (see filter_patterns) are listed under the names of their suites, as Catch2 lists them:

All available test cases:
Sample
Check various conditions
Check strings
Explicit namespace suite
Check one
3 test cases in 2 test suites
A named, runnable test suite registered with the test runner.
Definition test.h:2059

The header is Matching test cases: when there are filter patterns, and the suites without selected test cases are not listed. The nested test cases are not listed, since they are created by the bodies of their parents, which do not run. The list is made of plain lines, the same with both reporters and with all the verbosity levels, and is written to the console and to the output file, if any; no report is written, and run_suites() returns 0, 1 if a call was rejected or an exception escaped a suite body, which makes the list incomplete (the error is written in the list, as an error: line, or a # error: comment with the TAP reporter), or 2 after an option error, or if the filters selected no test case.

Since
6.0.0

Definition at line 455 of file runner-options.h.

Referenced by runner_options(), micro_os_plus::micro_test_plus::detail::runnable_base::accepts_test_case(), micro_os_plus::micro_test_plus::runner::add_top_suite(), micro_os_plus::micro_test_plus::detail::runnable_base::after_test_case_create(), micro_os_plus::micro_test_plus::runner::initialise(), micro_os_plus::micro_test_plus::runner::reject_call(), micro_os_plus::micro_test_plus::runner::run_child_suites(), and micro_os_plus::micro_test_plus::runner::run_suites().

◆ output_file_path

std::string micro_os_plus::micro_test_plus::runner_options::output_file_path {}

Set by --output-file=<path> or --output-file <path>. When it is empty (the default), no file is written. The reporter opens the file when it is created by initialise(); if the file cannot be opened, the error is reported on stderr and on the console, no test is run, and runner::run_suites() returns 2.

Definition at line 368 of file runner-options.h.

Referenced by micro_os_plus::micro_test_plus::detail::reporter::reporter(), runner_options(), and micro_os_plus::micro_test_plus::runner::initialise().

◆ selected_reporter

reporter_kind micro_os_plus::micro_test_plus::runner_options::selected_reporter { reporter_kind::tap }

Set by --reporter=<name> or --reporter <name>, where the name is tap or human.

Definition at line 345 of file runner-options.h.

Referenced by runner_options(), and micro_os_plus::micro_test_plus::runner::initialise().

◆ unknown_option_

bool micro_os_plus::micro_test_plus::runner_options::unknown_option_ { false }
private

Set by the parsing constructor, with the error; tested by has_unknown_option().

Definition at line 609 of file runner-options.h.

Referenced by runner_options(), and has_unknown_option().

◆ verbosity_level

micro_test_plus::verbosity micro_os_plus::micro_test_plus::runner_options::verbosity_level

The documentation for this class was generated from the following files: