From e1c319f96b371bf80864399490a39a74ecef2e6b Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Apr 2024 22:36:14 +0200 Subject: [PATCH] Add an integration test for reading from "/dev/stdin" on unix-like systems --- tests/integration.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/integration.rs b/tests/integration.rs index 240d60b..8c0491a 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -206,5 +206,21 @@ fn read_from_stdin() -> Result<(), Box> { .success() .stdout(predicate::str::is_empty()); + #[cfg(unix)] + { + let mut cmd = Command::cargo_bin("diffutils")?; + cmd.arg("-u") + .arg(file1.path()) + .arg("/dev/stdin") + .write_stdin("bar\n"); + cmd.assert() + .code(predicate::eq(1)) + .failure() + .stdout(predicate::eq(format!( + "--- {}\t\n+++ /dev/stdin\t\n@@ -1 +1 @@\n-foo\n+bar\n", + file1.path().to_string_lossy() + ))); + } + Ok(()) }