mirror of
https://github.com/async-rs/async-std.git
synced 2025-01-30 01:05:31 +00:00
Merge branch 'master' of github.com:async-std/async-std
This commit is contained in:
commit
5c17185464
4 changed files with 46 additions and 2 deletions
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Expose `fs::create_dir_all`
|
||||
|
||||
# [0.99.4] - 2019-08-21
|
||||
|
||||
## Changes
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
|
||||
use crate::task::blocking;
|
||||
use crate::io;
|
||||
use crate::task::blocking;
|
||||
|
||||
/// Creates a new, empty directory and all of its parents if they are missing.
|
||||
///
|
||||
|
|
|
@ -32,6 +32,7 @@ pub use std::fs::{FileType, Metadata, Permissions};
|
|||
pub use canonicalize::canonicalize;
|
||||
pub use copy::copy;
|
||||
pub use create_dir::create_dir;
|
||||
pub use create_dir_all::create_dir_all;
|
||||
pub use hard_link::hard_link;
|
||||
pub use metadata::metadata;
|
||||
pub use read::read;
|
||||
|
@ -49,6 +50,7 @@ pub use write::write;
|
|||
mod canonicalize;
|
||||
mod copy;
|
||||
mod create_dir;
|
||||
mod create_dir_all;
|
||||
mod dir_builder;
|
||||
mod dir_entry;
|
||||
mod file;
|
||||
|
|
40
tests/io_timeout.rs
Normal file
40
tests/io_timeout.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use async_std::io;
|
||||
use async_std::task;
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "timed out")]
|
||||
fn io_timeout_timedout() {
|
||||
task::block_on(async {
|
||||
io::timeout(Duration::from_secs(1), async {
|
||||
let stdin = io::stdin();
|
||||
let mut line = String::new();
|
||||
let _n = stdin.read_line(&mut line).await?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
.unwrap(); // We should panic with a timeout error
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "My custom error")]
|
||||
fn io_timeout_future_err() {
|
||||
task::block_on(async {
|
||||
io::timeout(Duration::from_secs(1), async {
|
||||
Err::<(), io::Error>(io::Error::new(io::ErrorKind::Other, "My custom error"))
|
||||
})
|
||||
.await
|
||||
.unwrap(); // We should panic with our own error
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn io_timeout_future_ok() {
|
||||
task::block_on(async {
|
||||
io::timeout(Duration::from_secs(1), async { Ok(()) })
|
||||
.await
|
||||
.unwrap(); // We shouldn't panic at all
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue