Skip to content

Commit

Permalink
Merge pull request #14 from ijackson/expose-testerror
Browse files Browse the repository at this point in the history
Expose testerror (and minor docs improvements)
  • Loading branch information
wiktor-k authored Jul 16, 2024
2 parents a1b7c7b + 7ef38fd commit e18e2c2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
// the docs illustrate the usage in test functions
#![allow(clippy::test_attr_in_doctest)]

/// Error with a stacktrace
/// Error, but one which immediately panics with a stacktrace
///
/// Usually used via [`TestResult`].
///
/// Any other type of error can be converted to this one but the
/// conversion will always panic.
///
/// This type is useful only in unit tests and cannot be directly instantiated.
/// This type is useful only in unit tests.
/// It cannot be instantiated: no values of this type can ever exist.
#[derive(Debug)]
#[doc(hidden)]
pub enum TestError {}

impl<T: std::fmt::Display> From<T> for TestError {
Expand All @@ -23,7 +25,7 @@ impl<T: std::fmt::Display> From<T> for TestError {
}
}

/// Unit test result
/// Unit test result - always panics when an error occurs
///
/// This type allows panicking when encountering any type of
/// failure. Thus it allows using the `?` operator in unit tests but still
Expand Down

0 comments on commit e18e2c2

Please sign in to comment.