Enum TestCaseError
pub enum TestCaseError
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
impl TestCaseError
fn reject(reason: impl Into<Reason>) -> SelfRejects 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}.fn fail(reason: impl Into<Reason>) -> SelfThe code under test failed the test.
The string should indicate the location of the failure, but may generally be any string.
Trait Implementations
impl Clone for TestCaseError
fn clone(&self) -> TestCaseError
impl Debug for TestCaseError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for TestCaseError
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<E: Error> From<E> for TestCaseError
fn from(cause: E) -> Self
Auto Trait Implementations
impl Freeze for TestCaseError
impl RefUnwindSafe for TestCaseError
impl Send for TestCaseError
impl Sync for TestCaseError
impl Unpin for TestCaseError
impl UnsafeUnpin for TestCaseError
impl UnwindSafe for TestCaseError
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for TestCaseError
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for TestCaseError
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for TestCaseError
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TestCaseError
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TestCaseError
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for TestCaseError
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for TestCaseError
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Read<Exclusive, BecauseExclusive> for TestCaseError
where
T: ?Sized,
impl<T> ToOwned for TestCaseError
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for TestCaseError
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for TestCaseError
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for TestCaseError
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for TestCaseError
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip<V> for TestCaseError
where
V: MultiLane<T>,
fn vzip(self) -> V