Skip to content

Commit

Permalink
test: fix test for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aciba90 committed Mar 30, 2024
1 parent bada514 commit ecde94a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ccv-cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@ use std::process::Command;
#[test]
fn file_doesnt_exist() -> Result<(), Box<dyn std::error::Error>> {
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(())
}
Expand Down

0 comments on commit ecde94a

Please sign in to comment.