feat: add tests
This commit is contained in:
17
__std/misc/src/bin/cursor_test.rs
Normal file
17
__std/misc/src/bin/cursor_test.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use std::io::{BufRead, Cursor, Read};
|
||||
|
||||
fn main() {
|
||||
let mut cursor = Cursor::new(b"hello world\n001");
|
||||
println!("{}", cursor.position());
|
||||
let mut buff = [0_u8; 5];
|
||||
cursor.read_exact(&mut buff).unwrap();
|
||||
println!("{:x?}", buff);
|
||||
println!("{}", cursor.position());
|
||||
let mut s = String::new();
|
||||
cursor.read_line(&mut s).unwrap();
|
||||
println!("[{}]", s);
|
||||
println!("{}", cursor.position());
|
||||
let mut s2 = String::new();
|
||||
cursor.read_to_string(&mut s2).unwrap();
|
||||
println!("[{}]", s2);
|
||||
}
|
||||
Reference in New Issue
Block a user