Enum proptest::test_runner::TestCaseError

source ·
pub enum TestCaseError {
    Reject(Reason),
    Fail(Reason),
}
Expand description

Errors which can be returned from test cases to indicate non-successful completion.

Note that in spite of the name, TestCaseError is currently not an instance of Error, since otherwise impl<E : Error> From<E> could not be provided.

Any Error can be converted to a TestCaseError, which places Error::display() into the Fail case.

Variants§

§

Reject(Reason)

The input was not valid for the test case. This does not count as a test failure (nor a success); rather, it simply signals to generate a new input and try again.

§

Fail(Reason)

The code under test failed the test.

Implementations§

source§

impl TestCaseError

source

pub fn reject(reason: impl Into<Reason>) -> Self

Rejects the generated test input as invalid for this test case. This does not count as a test failure (nor a success); rather, it simply signals to generate a new input and try again.

The string gives the location and context of the rejection, and should be suitable for formatting like Foo did X at {whence}.

source

pub fn fail(reason: impl Into<Reason>) -> Self

The code under test failed the test.

The string should indicate the location of the failure, but may generally be any string.

Trait Implementations§

source§

impl Clone for TestCaseError

source§

fn clone(&self) -> TestCaseError

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TestCaseError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for TestCaseError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<E: Error> From<E> for TestCaseError

source§

fn from(cause: E) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V