pub struct ConfigurationBuilder { /* private fields */ }
Expand description
Builder for Configuration
.
Implementations§
Source§impl ConfigurationBuilder
impl ConfigurationBuilder
Sourcepub fn parallel(&mut self, value: bool) -> &mut Self
pub fn parallel(&mut self, value: bool) -> &mut Self
Whether the runner executes tests in parallel
Sourcepub fn exit_on_failure(&mut self, value: bool) -> &mut Self
pub fn exit_on_failure(&mut self, value: bool) -> &mut Self
Whether the runner exits the procees upon encountering failures
Sourcepub fn build(&self) -> Result<Configuration, String>
pub fn build(&self) -> Result<Configuration, String>
Examples found in repository?
examples/multi.rs (line 11)
9pub fn main() {
10 let logger = Arc::new(rspec::Logger::new(io::stdout()));
11 let configuration = rspec::ConfigurationBuilder::default().build().unwrap();
12 let runner = rspec::Runner::new(configuration, vec![logger]);
13
14 // A test suite using the `suite`, `context`, `example` syntax family:
15 runner.run(&rspec::suite("an value of ten", 10, |ctx| {
16 ctx.context("adding 5 to it", |ctx| {
17 ctx.example("results in fifteen", |num| {
18 assert_eq!(*num, 15);
19 });
20 });
21 }));
22
23 // A test suite using the `describe`, `specify`, `it` syntax family:
24 runner.run(&rspec::describe("an value of ten", 10, |ctx| {
25 ctx.specify("adding 5 to it", |ctx| {
26 ctx.it("results in fifteen", |num| {
27 assert_eq!(*num, 15);
28 });
29 });
30 }));
31
32 // A test suite using the `given`, `when`, `then` syntax family:
33 runner.run(&rspec::given("an value of ten", 10, |ctx| {
34 ctx.when("adding 5 to it", |ctx| {
35 ctx.then("results in fifteen", |num| {
36 assert_eq!(*num, 15);
37 });
38 });
39 }));
40}
Trait Implementations§
Source§impl Clone for ConfigurationBuilder
impl Clone for ConfigurationBuilder
Source§fn clone(&self) -> ConfigurationBuilder
fn clone(&self) -> ConfigurationBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for ConfigurationBuilder
impl Default for ConfigurationBuilder
Source§fn default() -> ConfigurationBuilder
fn default() -> ConfigurationBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigurationBuilder
impl RefUnwindSafe for ConfigurationBuilder
impl Send for ConfigurationBuilder
impl Sync for ConfigurationBuilder
impl Unpin for ConfigurationBuilder
impl UnwindSafe for ConfigurationBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more