pub struct BinTestBuilder { /* private fields */ }
Expand description
Allows configuration of a workspace to find an executable in.
This builder is completely const constructible.
Implementations§
Source§impl BinTestBuilder
impl BinTestBuilder
Sourcepub const fn release(self) -> Self
pub const fn release(self) -> Self
Build in release mode, this is the default for release builds.
Sourcepub const fn all_targets(self) -> Self
pub const fn all_targets(self) -> Self
Build all targets (–lib –bins –tests –benches –examples).
Sourcepub const fn features(self, features: &'static str) -> Self
pub const fn features(self, features: &'static str) -> Self
Configure ‘–features’ list of features to build.
Sourcepub const fn binary(self, binary: &'static str) -> Self
pub const fn binary(self, binary: &'static str) -> Self
Allow only building a specific binary in the case of multiple in a workspace/package.
Sourcepub const fn binaries(self, binaries: &'static [&'static str]) -> Self
pub const fn binaries(self, binaries: &'static [&'static str]) -> Self
Allow only building specific binaríes in the case of multiple in a workspace/package.
Sourcepub const fn example(self, example: &'static str) -> Self
pub const fn example(self, example: &'static str) -> Self
Allow only building a specific example in the case of multiple in a workspace/package.
Sourcepub const fn examples(self, examples: &'static [&'static str]) -> Self
pub const fn examples(self, examples: &'static [&'static str]) -> Self
Allow only building specific examples in the case of multiple in a workspace/package.
Sourcepub fn build(self) -> &'static BinTest
pub fn build(self) -> &'static BinTest
Constructs a BinTest
with from this builder 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, this can be either achieved by calling
BinTest::with()
always with the same configuration or by providing a function that
constructs and returns the BinTest
singleton:
use bintest::{BinTest, BinTestBuilder};
// #[cfg(test)]
fn my_bintest() -> &'static BinTest {
// The Builder can be all const constructed
static BINTEST_CONFIG: BinTestBuilder = BinTest::with().quiet();
BINTEST_CONFIG.build()
}
// #[test]
fn example() {
let bintest = my_bintest();
}
Trait Implementations§
Source§impl Clone for BinTestBuilder
impl Clone for BinTestBuilder
Source§fn clone(&self) -> BinTestBuilder
fn clone(&self) -> BinTestBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more