mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 09:10:40 -05:00
17 lines
384 B
Rust
17 lines
384 B
Rust
|
// { "preopens": { "/fixture": "fixture" } }
|
||
|
|
||
|
use std::io::Read;
|
||
|
|
||
|
fn main() {
|
||
|
let mut file = std::fs::File::open("/fixture/file").unwrap();
|
||
|
let mut buffer = [0; 2];
|
||
|
|
||
|
assert_eq!(file.read(&mut buffer).unwrap(), 2);
|
||
|
assert_eq!(&buffer, b"fi");
|
||
|
|
||
|
assert_eq!(file.read(&mut buffer).unwrap(), 2);
|
||
|
assert_eq!(&buffer, b"le");
|
||
|
|
||
|
assert_eq!(file.read(&mut buffer).unwrap(), 1);
|
||
|
}
|