Skip to content

Commit 2b4fbd9

Browse files
committed
tests/fold: add tests to read from pseudo device streams
1 parent 6f84804 commit 2b4fbd9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/by-util/test_fold.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,18 @@ fn test_bytewise_carriage_return_is_not_word_boundary() {
889889
.succeeds()
890890
.stdout_is("fizz\rb\nuzz\rfi\nzzbuzz"); // spell-checker:disable-line
891891
}
892+
893+
#[test]
894+
fn test_bytewise_read_from_pseudo_device() {
895+
let mut child = new_ucmd!().arg("-b").arg("/dev/zero").run_no_wait();
896+
897+
let timeout = std::time::Duration::from_millis(100);
898+
std::thread::sleep(timeout);
899+
child.close_stdin();
900+
assert!(child.stdout_all().contains("\x00\x0a"));
901+
assert!(child.stderr_all().is_empty());
902+
}
903+
892904
#[test]
893905
fn test_obsolete_syntax() {
894906
new_ucmd!()

0 commit comments

Comments
 (0)