rust/tests/run-pass/file_read.rs

14 lines
416 B
Rust
Raw Normal View History

2019-09-24 17:28:00 -05:00
// ignore-windows: File handling is not implemented yet
// compile-flags: -Zmiri-disable-isolation
use std::fs::File;
use std::io::Read;
fn main() {
2019-09-25 11:12:46 -05:00
// FIXME: create the file and delete it when `rm` is implemented.
2019-09-24 17:28:00 -05:00
let mut file = File::open("./tests/hello.txt").unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
assert_eq!("Hello, World!\n", contents);
}