about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-09-04 22:04:18 -0400
committerBen Morrison <ben@gbmor.dev>2019-09-04 22:04:18 -0400
commit567a66d30fb86ad144e3deec256e27d05a611c2d (patch)
treefd358a6fe7ee1600c8b08b41388ad605e78f951e /src
parentb50586f991c1414cb322413a9b8a73fe40a104f5 (diff)
downloadclinte-567a66d30fb86ad144e3deec256e27d05a611c2d.tar.gz
error helper test
Diffstat (limited to 'src')
-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);
+    }
+}