diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2024-07-24 22:02:48 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2024-07-30 19:22:54 +0000 |
| commit | a75d2f9d384135c5f0f6bd6d26ec2ba9aa76745a (patch) | |
| tree | f2166589e82359f98373328f1392d9c363aaa06a /library/std/src/pipe | |
| parent | 006c8df322e55c14d845e1fe317ca1445c2f8e6b (diff) | |
| download | rust-a75d2f9d384135c5f0f6bd6d26ec2ba9aa76745a.tar.gz rust-a75d2f9d384135c5f0f6bd6d26ec2ba9aa76745a.zip | |
Cleanup sys module to match house style
Diffstat (limited to 'library/std/src/pipe')
| -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"); +} |
