diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-09-04 22:04:18 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-09-04 22:04:18 -0400 |
commit | 567a66d30fb86ad144e3deec256e27d05a611c2d (patch) | |
tree | fd358a6fe7ee1600c8b08b41388ad605e78f951e | |
parent | b50586f991c1414cb322413a9b8a73fe40a104f5 (diff) | |
download | clinte-567a66d30fb86ad144e3deec256e27d05a611c2d.tar.gz |
error helper test
-rw-r--r-- | src/error.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 3265271..032e2c2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -10,3 +10,22 @@ where } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn shouldnt_panic() { + let ok: Result<&str, &str> = Ok("okay"); + let rhs = helper(ok); + assert_eq!("okay", rhs); + } + + #[test] + #[should_panic] + fn should_panic() { + let err: Result<&str, &str> = Err("oops"); + helper(err); + } +} |