Skip to main content

Add a test for thumbnailing a non-existent file

ID
1c46ebf
date
2024-08-20 12:07:24+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
cb7ad6c
message
Add a test for thumbnailing a non-existent file
changed files
1 file, 9 additions

Changed files

src/main.rs (5696) → src/main.rs (6016)

diff --git a/src/main.rs b/src/main.rs
index d36ac51..79388f7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -112,6 +112,15 @@ mod test_cli {
     }
 
     #[test]
+    fn it_fails_if_you_pass_a_non_existent_file() {
+        let output = get_failure(&["doesnotexist.txt", "--width=50", "--out-dir=/tmp"]);
+
+        assert_eq!(output.exit_code, 1);
+        assert_eq!(output.stderr, "No such file or directory (os error 2)\n");
+        assert_eq!(output.stdout, "");
+    }
+
+    #[test]
     fn it_fails_if_you_pass_a_non_image() {
         let output = get_failure(&["Cargo.toml", "--width=50", "--out-dir=/tmp"]);