Struct sample_std::TestResult
source · pub struct TestResult { /* private fields */ }
Expand description
Describes the status of a single instance of a test.
All testable things must be capable of producing a TestResult
.
Implementations§
source§impl TestResult
impl TestResult
sourcepub fn passed() -> TestResult
pub fn passed() -> TestResult
Produces a test result that indicates the current test has passed.
sourcepub fn failed() -> TestResult
pub fn failed() -> TestResult
Produces a test result that indicates the current test has failed.
sourcepub fn error<S>(msg: S) -> TestResultwhere
S: Into<String>,
pub fn error<S>(msg: S) -> TestResultwhere S: Into<String>,
Produces a test result that indicates failure from a runtime error.
sourcepub fn discard() -> TestResult
pub fn discard() -> TestResult
Produces a test result that instructs quickcheck
to ignore it.
This is useful for restricting the domain of your properties.
When a test is discarded, quickcheck
will replace it with a
fresh one (up to a certain limit).
sourcepub fn from_bool(b: bool) -> TestResult
pub fn from_bool(b: bool) -> TestResult
Converts a bool
to a TestResult
. A true
value indicates that
the test has passed and a false
value indicates that the test
has failed.
sourcepub fn must_fail<T, F>(f: F) -> TestResultwhere
F: FnOnce() -> T + 'static,
T: 'static,
pub fn must_fail<T, F>(f: F) -> TestResultwhere F: FnOnce() -> T + 'static, T: 'static,
Tests if a “procedure” fails when executed. The test passes only if
f
generates a task failure during its execution.
sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Returns true
if and only if this test result describes a failing
test.
Trait Implementations§
source§impl Clone for TestResult
impl Clone for TestResult
source§fn clone(&self) -> TestResult
fn clone(&self) -> TestResult
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more