|
@@ -55,4 +55,24 @@ mod tests {
|
|
|
Err(err) => panic!("{}", err),
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn decode_fail_test() {
|
|
|
+ let t1: String = String::from("yAyL3WlysPBdTEnPDs+JnWlytjv"); // Invalid base64
|
|
|
+ let t2 = decode(&t1);
|
|
|
+ match t2 {
|
|
|
+ Ok(s) => panic!("Expected failure! Got '{}'", s),
|
|
|
+ Err(_) => ()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn decode_fail_utf8_test() {
|
|
|
+ let t1: String = String::from("woXChQ=="); // Invalid UTF-8
|
|
|
+ let t2 = decode(&t1);
|
|
|
+ match t2 {
|
|
|
+ Ok(s) => panic!("Expected failure! Got '{}'", s),
|
|
|
+ Err(_) => ()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|