summary refs log tree commit diff stats
path: root/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs19
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);
+    }
+}