Procházet zdrojové kódy

Updated tests to look for specific error.

Which seems harder then you'd expect to do.
e.to_string() doesn't show inner errors.
format!(":?}", e) does.
Steve Thielemann před 1 týdnem
rodič
revize
f17f5a6551
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      src/cache.rs

+ 5 - 0
src/cache.rs

@@ -743,6 +743,11 @@ mod tests {
 
             if let Error::ReqwestError(e) = e {
                 // expected
+                assert!(e.is_connect(), "Connect error");
+                // e.to_string() doesn't have all of the inner errors.
+                let message = format!("{:?}", e);
+                assert!(message.contains("ConnectionRefused"), "Connection refused");
+                assert!(message.contains("tcp connect error"), "TCP Connect error");
                 // println!("Yes, reqwest::Error: {:?}", e);
             } else {
                 panic!("Not the error type we were expecting: {:?}", e);