Skip to content

Commit

Permalink
tests/cp: add test to copy from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
DaringCuteSeal committed Jan 3, 2025
1 parent d7ac1b0 commit 4984c85
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5914,3 +5914,19 @@ fn test_cp_no_file() {
.code_is(1)
.stderr_contains("error: the following required arguments were not provided:");
}

#[test]
#[cfg(unix)]
fn test_cp_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 4984c85

Please sign in to comment.