Skip to content

Commit

Permalink
Un-hardcode a test filename in an integration test (fixes uutils#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
oSoMoN committed Apr 23, 2024
1 parent 3a8eddf commit 3dc3fdf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@ fn unknown_param() -> Result<(), Box<dyn std::error::Error>> {
fn cannot_read_files() -> Result<(), Box<dyn std::error::Error>> {
let file = NamedTempFile::new()?;

let nofile = NamedTempFile::new()?;
let nopath = nofile.into_temp_path();
std::fs::remove_file(&nopath)?;

let mut cmd = Command::cargo_bin("diffutils")?;
cmd.arg("foo.txt").arg(file.path());
cmd.arg(&nopath).arg(file.path());
cmd.assert()
.code(predicate::eq(2))
.failure()
.stderr(predicate::str::starts_with("Failed to read from-file"));

let mut cmd = Command::cargo_bin("diffutils")?;
cmd.arg(file.path()).arg("foo.txt");
cmd.arg(file.path()).arg(&nopath);
cmd.assert()
.code(predicate::eq(2))
.failure()
.stderr(predicate::str::starts_with("Failed to read to-file"));

let mut cmd = Command::cargo_bin("diffutils")?;
cmd.arg("foo.txt").arg("foo.txt");
cmd.arg(&nopath).arg(&nopath);
cmd.assert()
.code(predicate::eq(2))
.failure()
Expand Down

0 comments on commit 3dc3fdf

Please sign in to comment.