From ecde94a544e6ed5a525ebc9712e6fdcf95cb54fa Mon Sep 17 00:00:00 2001 From: Alberto Contreras Date: Sat, 30 Mar 2024 21:39:25 +0100 Subject: [PATCH] test: fix test for windows --- ccv-cli/tests/cli.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ccv-cli/tests/cli.rs b/ccv-cli/tests/cli.rs index 89ff1a9..39b2a16 100644 --- a/ccv-cli/tests/cli.rs +++ b/ccv-cli/tests/cli.rs @@ -6,11 +6,19 @@ use std::process::Command; #[test] fn file_doesnt_exist() -> Result<(), Box> { let mut cmd = Command::cargo_bin("ccv-cli")?; - cmd.arg("validate").arg("test/file/doesnt/exist"); - cmd.assert().failure().stderr(predicate::str::contains( - r#"Error reading "test/file/doesnt/exist": No such file or directory (os error 2)"#, - )); + + #[cfg(not(windows))] + let os_error = "No such file or directory (os error 2)"; + #[cfg(windows)] + let os_error = "The system cannot find the path specified. (os error 3)"; + + cmd.assert() + .failure() + .stderr(predicate::str::contains(format!( + r#"Error reading "test/file/doesnt/exist": {}"#, + os_error + ))); Ok(()) }