about summary refs log tree commit diff
path: root/library/std/src/io/tests.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-19 04:43:54 +0000
committerbors <bors@rust-lang.org>2024-02-19 04:43:54 +0000
commitbea5bebf3defc56e5e3446b4a95c685dbb885fd3 (patch)
tree225f3ad50e8f19653c5e4e2d708df074f8148ba1 /library/std/src/io/tests.rs
parentd5735645753e990a72446094f703df9b5e421555 (diff)
parentebc59703292fd216d7ec1e027e0f3b78387a8ddf (diff)
downloadrust-bea5bebf3defc56e5e3446b4a95c685dbb885fd3.tar.gz
rust-bea5bebf3defc56e5e3446b4a95c685dbb885fd3.zip
Auto merge of #105917 - a1phyr:read_chain_more_impls, r=workingjubilee
Specialize some methods of `io::Chain`

This PR specializes the implementation of some methods of `io::Chain`, which could bring performance improvements when using it.
Diffstat (limited to 'library/std/src/io/tests.rs')
-rw-r--r--library/std/src/io/tests.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs
index fd7e51688cd..5396f7f6e21 100644
--- a/library/std/src/io/tests.rs
+++ b/library/std/src/io/tests.rs
@@ -262,6 +262,17 @@ fn chain_bufread() {
 }
 
 #[test]
+fn chain_splitted_char() {
+    let chain = b"\xc3".chain(b"\xa9".as_slice());
+    assert_eq!(crate::io::read_to_string(chain).unwrap(), "é");
+
+    let mut chain = b"\xc3".chain(b"\xa9\n".as_slice());
+    let mut buf = String::new();
+    assert_eq!(chain.read_line(&mut buf).unwrap(), 3);
+    assert_eq!(buf, "é\n");
+}
+
+#[test]
 fn bufreader_size_hint() {
     let testdata = b"ABCDEFGHIJKL";
     let mut buf_reader = BufReader::new(&testdata[..]);