about summary refs log tree commit diff stats
path: root/src/err.rs
diff options
context:
space:
mode:
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"));
+    }
+}