Skip to content

Commit 43b9c52

Browse files
authored
Merge pull request #62 from oSoMoN/integration-no-hardcoded-filename
Un-hardcode a test filename in an integration test (fixes #61)
2 parents 3a8eddf + 3dc3fdf commit 43b9c52

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/integration.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,26 @@ fn unknown_param() -> Result<(), Box<dyn std::error::Error>> {
2626
fn cannot_read_files() -> Result<(), Box<dyn std::error::Error>> {
2727
let file = NamedTempFile::new()?;
2828

29+
let nofile = NamedTempFile::new()?;
30+
let nopath = nofile.into_temp_path();
31+
std::fs::remove_file(&nopath)?;
32+
2933
let mut cmd = Command::cargo_bin("diffutils")?;
30-
cmd.arg("foo.txt").arg(file.path());
34+
cmd.arg(&nopath).arg(file.path());
3135
cmd.assert()
3236
.code(predicate::eq(2))
3337
.failure()
3438
.stderr(predicate::str::starts_with("Failed to read from-file"));
3539

3640
let mut cmd = Command::cargo_bin("diffutils")?;
37-
cmd.arg(file.path()).arg("foo.txt");
41+
cmd.arg(file.path()).arg(&nopath);
3842
cmd.assert()
3943
.code(predicate::eq(2))
4044
.failure()
4145
.stderr(predicate::str::starts_with("Failed to read to-file"));
4246

4347
let mut cmd = Command::cargo_bin("diffutils")?;
44-
cmd.arg("foo.txt").arg("foo.txt");
48+
cmd.arg(&nopath).arg(&nopath);
4549
cmd.assert()
4650
.code(predicate::eq(2))
4751
.failure()

0 commit comments

Comments
 (0)