about summary refs log tree commit diff stats
path: root/src/err.rs
diff options
context:
space:
mode:
authorBenjamin Morrison <ben@gbmor.org>2023-06-21 22:32:46 -0400
committerBenjamin Morrison <ben@gbmor.org>2023-06-21 22:32:46 -0400
commitaf0ce6fb874bd486f837a5636a7f0d05841fde57 (patch)
treebb32a94d12d38b5aaac9436511722c3b0d8e6f6e /src/err.rs
parentb1c03b7e4c7b02d45ca022eb1992db0c4784f5b6 (diff)
downloadlaika-trunk.tar.gz
some tests for modules response and err HEAD trunk
Diffstat (limited to 'src/err.rs')
-rw-r--r--src/err.rs16
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"));
+    }
+}