diff options
author | Benjamin Morrison <ben@gbmor.org> | 2023-06-21 22:32:46 -0400 |
---|---|---|
committer | Benjamin Morrison <ben@gbmor.org> | 2023-06-21 22:32:46 -0400 |
commit | af0ce6fb874bd486f837a5636a7f0d05841fde57 (patch) | |
tree | bb32a94d12d38b5aaac9436511722c3b0d8e6f6e /src/err.rs | |
parent | b1c03b7e4c7b02d45ca022eb1992db0c4784f5b6 (diff) | |
download | laika-trunk.tar.gz |
Diffstat (limited to 'src/err.rs')
-rw-r--r-- | src/err.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/err.rs b/src/err.rs index 6c178bd..8b4dffc 100644 --- a/src/err.rs +++ b/src/err.rs @@ -49,3 +49,19 @@ impl std::fmt::Display for Supernova { write!(f, "{}", &self.message) } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_supernova() { + let mut sn = Supernova::boom("test"); + assert_eq!(sn.code(), response::Code::Unknown); + + sn.with_code(response::Code::BadRequest); + assert_eq!(sn.code(), response::Code::BadRequest); + + assert_eq!(format!("{}", sn), String::from("test")); + } +} |