Skip to content

Commit 908e155

Browse files
tests/cp: add test to copy from stdin
1 parent b75d0f9 commit 908e155

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/by-util/test_cp.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6031,3 +6031,18 @@ fn test_cp_preserve_xattr_readonly_source() {
60316031
"Extended attributes were not preserved"
60326032
);
60336033
}
6034+
6035+
#[test]
6036+
fn test_cp_from_stdin() {
6037+
let (at, mut ucmd) = at_and_ucmd!();
6038+
let target = "target";
6039+
let test_string = "Hello, World!\n";
6040+
6041+
ucmd.arg("/dev/fd/0")
6042+
.arg(target)
6043+
.pipe_in(test_string)
6044+
.succeeds();
6045+
6046+
assert!(at.file_exists(target));
6047+
assert_eq!(at.read(target), test_string);
6048+
}

0 commit comments

Comments
 (0)