pub struct Arguments {
Show 14 fields pub include_ignored: bool, pub ignored: bool, pub test: bool, pub bench: bool, pub list: bool, pub nocapture: bool, pub exact: bool, pub quiet: bool, pub test_threads: Option<usize>, pub logfile: Option<String>, pub skip: Vec<String>, pub color: Option<ColorSetting>, pub format: Option<FormatSetting>, pub filter: Option<String>,
}
Expand description

Command line arguments.

This type represents everything the user can specify via CLI args. The main method is from_args which reads the global std::env::args() and parses them into this type.

libtest-mimic supports a subset of all args/flags supported by the official test harness. There are also some other minor CLI differences, but the main use cases should work exactly like with the built-in harness.

Fields

include_ignored: bool

Run ignored and non-ignored tests.

ignored: bool

Run only ignored tests.

test: bool

Run tests, but not benchmarks.

bench: bool

Run benchmarks, but not tests.

list: bool

Only list all tests and benchmarks.

nocapture: bool

No-op, ignored (libtest-mimic always runs in no-capture mode)

exact: bool

If set, filters are matched exactly rather than by substring.

quiet: bool

If set, display only one character per test instead of one line. Especially useful for huge test suites.

This is an alias for --format=terse. If this is set, format is None.

test_threads: Option<usize>

Number of threads used for parallel testing.

logfile: Option<String>

Path of the logfile. If specified, everything will be written into the file instead of stdout.

skip: Vec<String>

A list of filters. Tests whose names contain parts of any of these filters are skipped.

color: Option<ColorSetting>

Specifies whether or not to color the output.

format: Option<FormatSetting>

Specifies the format of the output.

filter: Option<String>

Filter string. Only tests which contain this string are run.

Implementations

Parses the global CLI arguments given to the application.

If the parsing fails (due to incorrect CLI args), an error is shown and the application exits. If help is requested (-h or --help), a help message is shown and the application exits, too.

Like from_args(), but operates on an explicit iterator and not the global arguments. Note that the first element is the executable name!

Trait Implementations

Append to Command so it can instantiate Self. Read more

Append to Command so it can update self. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

👎 Deprecated since 3.1.0:

Replaced with `CommandFactory::command

Deprecated, replaced with CommandFactory::command

👎 Deprecated since 3.1.0:

Replaced with `CommandFactory::command_for_update

Deprecated, replaced with CommandFactory::command_for_update

Build an Command that can instantiate Self. Read more

Build an Command that can update self. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more

Assign values from ArgMatches to self.

Parse from std::env::args_os(), exit on error

Parse from std::env::args_os(), return Err on error.

Parse from iterator, exit on error

Parse from iterator, return Err on error.

Update from iterator, exit on error

Update from iterator, return Err on error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.