feat: add tests
This commit is contained in:
@@ -205,6 +205,7 @@ Project or files:
|
|||||||
│ ├── async_await
|
│ ├── async_await
|
||||||
│ ├── into
|
│ ├── into
|
||||||
│ ├── iter
|
│ ├── iter
|
||||||
|
│ ├── misc
|
||||||
│ ├── ops
|
│ ├── ops
|
||||||
│ └── thread
|
│ └── thread
|
||||||
├── __template
|
├── __template
|
||||||
@@ -215,6 +216,7 @@ Project or files:
|
|||||||
│ ├── colored_msg
|
│ ├── colored_msg
|
||||||
│ ├── confy_table
|
│ ├── confy_table
|
||||||
│ ├── cursive-demo
|
│ ├── cursive-demo
|
||||||
|
│ ├── dialoguer-demo
|
||||||
│ ├── indicatif
|
│ ├── indicatif
|
||||||
│ ├── prettyprint
|
│ ├── prettyprint
|
||||||
│ ├── rustyline
|
│ ├── rustyline
|
||||||
@@ -280,6 +282,6 @@ Project or files:
|
|||||||
├── vec.rs
|
├── vec.rs
|
||||||
└── while.rs
|
└── while.rs
|
||||||
|
|
||||||
249 directories, 40 files
|
251 directories, 40 files
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
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