async-std 1.1.0

Async version of the Rust standard library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use async_std::{fs, task};

#[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)
            ),
        }
    })
}