We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f21a254 commit 9f57adfCopy full SHA for 9f57adf
1 file changed
src/reader.rs
@@ -457,4 +457,20 @@ mod tests {
457
assert_eq!(None, r.try_read());
458
459
}
460
+
461
+ #[test]
462
+ fn test_try_read_multibyte_byte() {
463
+ // bytes >= 0x80 decode to multi-byte chars in the buffer, so draining one byte used to panic
464
+ let f = io::Cursor::new("é");
465
+ let mut r = NBReader::new(f, Options::default());
466
+ let mut count = 0;
467
+ loop {
468
+ match r.try_read() {
469
+ Some(_) => count += 1,
470
+ None if count == "é".len() => break,
471
+ None => thread::sleep(time::Duration::from_millis(10)),
472
+ }
473
474
+ assert_eq!(count, "é".len());
475
476
0 commit comments