Skip to content

Commit ac614da

Browse files
tests/cp: add test to copy from stdin
1 parent 0d2ded8 commit ac614da

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
@@ -5914,3 +5914,19 @@ fn test_cp_no_file() {
59145914
.code_is(1)
59155915
.stderr_contains("error: the following required arguments were not provided:");
59165916
}
5917+
5918+
#[test]
5919+
#[cfg(unix)]
5920+
fn test_cp_from_stdin() {
5921+
let (at, mut ucmd) = at_and_ucmd!();
5922+
let target = "target";
5923+
let test_string = "Hello, World!\n";
5924+
5925+
ucmd.arg("/dev/fd/0")
5926+
.arg(target)
5927+
.pipe_in(test_string)
5928+
.succeeds();
5929+
5930+
assert!(at.file_exists(target));
5931+
assert_eq!(at.read(target), test_string);
5932+
}

0 commit comments

Comments
 (0)