pub struct BinTest { /* private fields */ }
Expand description
Access to binaries build by cargo build
. Starting with version 2.0.0 this is a
singleton that is constructed by the first call to BinTest::new()
or
BinTest::with().build()
. All calls to BinTest
must be configured with the same
configuration values, otherwise a panic will occur. This is made in anticipation of future
versions which will allow building binary artifacts with different configurations while
not panicking then.
Implementations§
source§impl BinTest
impl BinTest
sourcepub fn new() -> &'static Self
pub fn new() -> &'static Self
Constructs a BinTest
with the default configuration if not already constructed.
Construction runs ‘cargo build’ and register all build executables. Executables are
identified by their name, without path and filename extension.
§Returns
A reference to a immutable BinTest
singleton that can be used to access the
executables.
§Panics
All tests must run with the same configuration, when using only BinTest::new()
this
is infallible. Mixing this with differing configs from BinTest::with()
will panic.
§Example
use bintest::BinTest;
let executables = BinTest::new();
sourcepub const fn with() -> BinTestBuilder
pub const fn with() -> BinTestBuilder
Creates a BinTestBuilder
for further customization.
§Example
use bintest::BinTest;
let executables = BinTest::with().quiet().build();
sourcepub fn list_executables(&self) -> Iter<'_, String, Utf8PathBuf>
pub fn list_executables(&self) -> Iter<'_, String, Utf8PathBuf>
Gives an (name, path)
iterator over all executables found.
§Example
use bintest::BinTest;
let executables = BinTest::new();
for (name, path) in executables.list_executables() {
println!("{} @ {}", name, path);
}
sourcepub fn command(&self, name: &str) -> Command
pub fn command(&self, name: &str) -> Command
Constructs a std::process::Command
for the given executable name