Struct libtest_mimic::Arguments
source · [−]pub struct Arguments {Show 13 fields
pub ignored: bool,
pub test: bool,
pub bench: bool,
pub list: bool,
pub nocapture: bool,
pub exact: bool,
pub quiet: bool,
pub num_threads: Option<usize>,
pub logfile: Option<String>,
pub skip: Vec<String>,
pub color: Option<ColorSetting>,
pub format: Option<FormatSetting>,
pub filter_string: 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.
The CLI is very similar to the one from the native test harness. However, there are minor differences:
- Most notable: the
--help
message is slightly different. This comes from the fact that this crate (right now) uses structopt (which usesclap
) while the originallibtest
usesdocopt
. --skip
only accepts one value per occurence (but can occur multiple times). This solves ambiguity with thefilter
value at the very end. Consider “--skip foo bar
”: should this be parsed asskip: vec!["foo", "bar"], filter: None
orskip: vec!["foo"], filter: Some("bar")
? Here, it’s clearly the latter version. If you need multiple values forskip
, do it like this:--skip foo --skip bar
.--bench
and--test
cannot be both set at the same time. It doesn’t make sense, but it’s allowed inlibtest
for some reason.
Note: just because all CLI args can be parsed, doesn’t mean that they
are all automatically used. Check [run_tests
][::run_tests] for information on which
arguments are automatically used and require special care.
Fields
ignored: bool
Determines if ignored tests should be run.
test: bool
Run tests, but not benchmarks.
bench: bool
Run benchmarks, but not tests.
list: bool
Only list all tests and benchmarks.
nocapture: bool
If set, stdout/stderr are not captured during the test but are instead printed directly.
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
.
num_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_string: Option<String>
Filter string. Only tests which contain this string are run.
Implementations
Trait Implementations
sourceimpl CommandFactory for Arguments
impl CommandFactory for Arguments
sourcefn into_app<'b>() -> Command<'b>
fn into_app<'b>() -> Command<'b>
Replaced with `CommandFactory::command
Deprecated, replaced with CommandFactory::command
sourcefn into_app_for_update<'b>() -> Command<'b>
fn into_app_for_update<'b>() -> Command<'b>
Replaced with `CommandFactory::command_for_update
Deprecated, replaced with CommandFactory::command_for_update
sourcefn command_for_update<'help>() -> App<'help>
fn command_for_update<'help>() -> App<'help>
sourceimpl FromArgMatches for Arguments
impl FromArgMatches for Arguments
sourcefn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Instantiate Self
from ArgMatches
, parsing the arguments as needed. Read more
sourcefn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
Assign values from ArgMatches
to self
.
sourceimpl Parser for Arguments
impl Parser for Arguments
sourcefn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Self where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Parse from iterator, exit on error
sourcefn try_parse_from<I, T>(itr: I) -> Result<Self, Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
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.
sourcefn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I) where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
Update from iterator, exit on error
sourcefn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error> where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
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
impl RefUnwindSafe for Arguments
impl Send for Arguments
impl Sync for Arguments
impl Unpin for Arguments
impl UnwindSafe for Arguments
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more