Skip to content

Commit e1c319f

Browse files
committed
Add an integration test for reading from "/dev/stdin" on unix-like systems
1 parent 84ad116 commit e1c319f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/integration.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,21 @@ fn read_from_stdin() -> Result<(), Box<dyn std::error::Error>> {
206206
.success()
207207
.stdout(predicate::str::is_empty());
208208

209+
#[cfg(unix)]
210+
{
211+
let mut cmd = Command::cargo_bin("diffutils")?;
212+
cmd.arg("-u")
213+
.arg(file1.path())
214+
.arg("/dev/stdin")
215+
.write_stdin("bar\n");
216+
cmd.assert()
217+
.code(predicate::eq(1))
218+
.failure()
219+
.stdout(predicate::eq(format!(
220+
"--- {}\t\n+++ /dev/stdin\t\n@@ -1 +1 @@\n-foo\n+bar\n",
221+
file1.path().to_string_lossy()
222+
)));
223+
}
224+
209225
Ok(())
210226
}

0 commit comments

Comments
 (0)