async-std/tests/verbose_errors.rs

17 lines
543 B
Rust
Raw Normal View History

2019-11-18 22:55:48 +00:00
use async_std::{fs, task};
2019-11-18 22:55:48 +00:00
#[test]
fn open_file() {
task::block_on(async {
let non_existing_file = "/ashjudlkahasdasdsikdhajik/asdasdasdasdasdasd/fjuiklashdbflasas";
let res = fs::File::open(non_existing_file).await;
match res {
Ok(_) => panic!("Found file with random name: We live in a simulation"),
Err(e) => assert_eq!(
"Could not open /ashjudlkahasdasdsikdhajik/asdasdasdasdasdasd/fjuiklashdbflasas",
&format!("{}", e)
),
}
})
}