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 6, 2025
1 parent b75d0f9 commit 908e155
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6031,3 +6031,18 @@ fn test_cp_preserve_xattr_readonly_source() {
"Extended attributes were not preserved"
);
}

#[test]
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 908e155

Please sign in to comment.