about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Venner <william@venner.io>2023-05-18 18:59:36 +0100
committerWilliam Venner <william@venner.io>2023-05-18 18:59:36 +0100
commit7c9ad34362ab545dd5be75637afd84b6287507a0 (patch)
tree0c5178d03f8dbbf24b4a28ea5730fbda543dbb22
parent4eea9763847250c89f535f6a8c3b0fd49d860e78 (diff)
downloadrust-7c9ad34362ab545dd5be75637afd84b6287507a0.tar.gz
rust-7c9ad34362ab545dd5be75637afd84b6287507a0.zip
Move `BufRead::skip_until` test to a more appropriate location
-rw-r--r--library/std/src/io/buffered/tests.rs28
-rw-r--r--library/std/src/io/tests.rs28
2 files changed, 28 insertions, 28 deletions
diff --git a/library/std/src/io/buffered/tests.rs b/library/std/src/io/buffered/tests.rs
index ca5d8fb4b7f..9d429e7090e 100644
--- a/library/std/src/io/buffered/tests.rs
+++ b/library/std/src/io/buffered/tests.rs
@@ -401,34 +401,6 @@ fn test_read_until() {
 }
 
 #[test]
-fn test_skip_until() {
-    let bytes: &[u8] = b"read\0ignore\0read\0ignore\0read\0ignore";
-    let mut reader = BufReader::new(bytes);
-
-    // read from the bytes, alternating between
-    // consuming `read\0`s and skipping `ignore\0`s
-    loop {
-        // consume `read\0`
-        let mut out = Vec::new();
-        let read = reader.read_until(0, &mut out).unwrap();
-        if read == 0 {
-            // eof
-            break;
-        } else {
-            assert_eq!(out, b"read\0");
-        }
-
-        // skip past `ignore\0`
-        reader.skip_until(0).unwrap();
-    }
-
-    // ensure we are at the end of the byte slice and that we can skip no further
-    // also ensure skip_until matches the behavior of read_until at EOF
-    let skipped = reader.skip_until(0).unwrap();
-    assert_eq!(skipped, 0);
-}
-
-#[test]
 fn test_line_buffer() {
     let mut writer = LineWriter::new(Vec::new());
     writer.write(&[0]).unwrap();
diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs
index d5a8c93b0ce..9a9a790d77d 100644
--- a/library/std/src/io/tests.rs
+++ b/library/std/src/io/tests.rs
@@ -26,6 +26,34 @@ fn read_until() {
 }
 
 #[test]
+fn skip_until() {
+    let bytes: &[u8] = b"read\0ignore\0read\0ignore\0read\0ignore";
+    let mut reader = BufReader::new(bytes);
+
+    // read from the bytes, alternating between
+    // consuming `read\0`s and skipping `ignore\0`s
+    loop {
+        // consume `read\0`
+        let mut out = Vec::new();
+        let read = reader.read_until(0, &mut out).unwrap();
+        if read == 0 {
+            // eof
+            break;
+        } else {
+            assert_eq!(out, b"read\0");
+        }
+
+        // skip past `ignore\0`
+        reader.skip_until(0).unwrap();
+    }
+
+    // ensure we are at the end of the byte slice and that we can skip no further
+    // also ensure skip_until matches the behavior of read_until at EOF
+    let skipped = reader.skip_until(0).unwrap();
+    assert_eq!(skipped, 0);
+}
+
+#[test]
 fn split() {
     let buf = Cursor::new(&b"12"[..]);
     let mut s = buf.split(b'3');