about summary refs log tree commit diff
path: root/library/std/src/io/tests.rs
diff options
context:
space:
mode:
authorJiahao XU <Jiahao_XU@outlook.com>2025-01-17 01:30:05 +1100
committerJiahao XU <Jiahao_XU@outlook.com>2025-01-17 01:30:05 +1100
commitefe888871c0b49ca9230649ea54b4d0f0bc62d25 (patch)
tree79eac14406cc687522324845965a8f38d28868f0 /library/std/src/io/tests.rs
parentd8a64098c9d0fb25699f657c6efff0bb418f7e18 (diff)
downloadrust-efe888871c0b49ca9230649ea54b4d0f0bc62d25.tar.gz
rust-efe888871c0b49ca9230649ea54b4d0f0bc62d25.zip
Move `std::pipe::*` into `std::io`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Diffstat (limited to 'library/std/src/io/tests.rs')
-rw-r--r--library/std/src/io/tests.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs
index 47cbb9614af..85098b3bb18 100644
--- a/library/std/src/io/tests.rs
+++ b/library/std/src/io/tests.rs
@@ -823,3 +823,20 @@ fn try_oom_error() {
     let io_err = io::Error::from(reserve_err);
     assert_eq!(io::ErrorKind::OutOfMemory, io_err.kind());
 }
+
+#[test]
+#[cfg(all(windows, unix, not(miri)))]
+fn pipe_creation_clone_and_rw() {
+    let (rx, tx) = std::io::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");
+}