Skip to content

Commit

Permalink
tests/install: add stdin test using fd from /dev/fd directly
Browse files Browse the repository at this point in the history
  • Loading branch information
DaringCuteSeal committed Nov 27, 2024
1 parent 370a0b4 commit 4169fb0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/by-util/test_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1751,3 +1751,19 @@ fn test_install_from_fifo() {
assert!(s.fixtures.file_exists(target_name));
assert_eq!(s.fixtures.read(target_name), test_string);
}

#[test]
#[cfg(unix)]
fn test_install_from_stdin() {
let (at, mut ucmd) = at_and_ucmd!();
let target = "target";
let test_string = "Hello, World!\n";

ucmd.arg("/dev/fd/0")
.arg(target)
.pipe_in(test_string)
.succeeds();

assert!(at.file_exists(target));
assert_eq!(at.read(target), test_string);
}

0 comments on commit 4169fb0

Please sign in to comment.