diff options
Diffstat (limited to 'library/std/src/pipe/tests.rs')
| -rw-r--r-- | library/std/src/pipe/tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/std/src/pipe/tests.rs b/library/std/src/pipe/tests.rs new file mode 100644 index 00000000000..9c38e106787 --- /dev/null +++ b/library/std/src/pipe/tests.rs @@ -0,0 +1,19 @@ +use crate::io::{Read, Write}; +use crate::pipe::pipe; + +#[test] +#[cfg(all(windows, unix, not(miri)))] +fn pipe_creation_clone_and_rw() { + let (rx, tx) = pipe().unwrap(); + + tx.try_clone().unwrap().write_all(b"12345").unwrap(); + drop(tx); + + let mut rx2 = rx.try_clone().unwrap(); + drop(rx); + + let mut s = String::new(); + rx2.read_to_string(&mut s).unwrap(); + drop(rx2); + assert_eq!(s, "12345"); +} |
