Skip to content

Commit c6d1923

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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/by-util/test_cp.rs

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

0 commit comments

Comments
 (0)