runner-options.cpp File
C++ source file with implementations for the µTest++ runner options. More...
Included Headers
#include "micro-os-plus/micro-test-plus/runner-options.h"
#include <string>
Namespaces Index
| namespace | micro_os_plus |
|
The primary namespace for the µOS++ framework. More... | |
| namespace | micro_test_plus |
|
Primary namespace for the µTest++ testing framework. More... | |
Description
C++ source file with implementations for the µTest++ runner options.
This source file contains the command-line parser of the µTest++ framework, implemented by the runner_options constructor taking the main() arguments, and the recording of the errors it finds.
All definitions reside within the micro_os_plus::micro_test_plus namespace.
This file must be included when building the µTest++ library.
File Listing
The file content with the documentation metadata removed is:
32#include "micro-os-plus/micro-test-plus/runner-options.h"
60namespace micro_os_plus::micro_test_plus
119 runner_options::runner_options (int argc, char* argv[])
133 arguments_.reserve (static_cast<size_t> (argc));
136 arguments_.emplace_back (argv[i] != nullptr ? argv[i] : "");
140 application_begin_ = arguments_.size ();
190 colour = colour_mode::always;
194 colour = colour_mode::never;
198 colour = colour_mode::automatic;
202 add_error ("unknown colour mode '", value, "'");
238 add_error ("unknown reporter '", value, "'");
244 output_file_path = value;
252 filter_patterns.emplace_back (value);
256 for (size_t i = 1; i < arguments_.size (); ++i)
258 const std::string_view argument{ arguments_[i] };
264 application_begin_ = i + 1;
269 application_begin_ = i;
280 verbosity_level = verbosity::quiet;
285 verbosity_level = verbosity::silent;
290 list_tests = true;
295 help = true;
323 add_error ("unknown option '", argument, "'");
324 unknown_option_ = true;
336 colour = colour_mode::always;
337 if (i + 1 < arguments_.size ()
338 && is_colour_mode (arguments_[i + 1]))
345 text.append (arguments_[i + 1]);
348 add_error (text);
353 if (i + 1 >= arguments_.size ())
355 add_error ("", matched->name, " option requires an argument");
358 value = arguments_[++i];
376 runner_options::add_error (std::string_view before, std::string_view value,
383 errors_.push_back (std::move (text));
Generated via doxygen2docusaurus 2.2.8 by Doxygen 1.18.0.