libtest_mimic

Struct Arguments

source
pub struct Arguments {
Show 16 fields pub include_ignored: bool, pub ignored: bool, pub test: bool, pub bench: bool, pub list: bool, pub nocapture: bool, pub show_output: bool, pub unstable_flags: Option<UnstableFlags>, 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)

§show_output: bool

No-op, ignored. libtest-mimic does not currently capture stdout.

§unstable_flags: Option<UnstableFlags>

No-op, ignored. Flag only exists for CLI compatibility with libtest.

§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§

source§

impl Arguments

source

pub fn from_args() -> Self

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.

source

pub fn from_iter<I>(iter: I) -> Self
where Self: Sized, I: IntoIterator, I::Item: Into<OsString> + Clone,

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§

source§

impl Args for Arguments

source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
source§

impl Clone for Arguments

source§

fn clone(&self) -> Arguments

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommandFactory for Arguments

source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
source§

impl Debug for Arguments

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Arguments

source§

fn default() -> Arguments

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

impl FromArgMatches for Arguments

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

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

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

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

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Parser for Arguments

source§

fn parse() -> Self

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

fn try_parse() -> Result<Self, Error>

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

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.