Skip to content

Commit 5c17185

Browse files
committed
Merge branch 'master' of github.com:async-std/async-std
2 parents 101979f + a14b11c commit 5c17185

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
77

88
## [Unreleased]
99

10+
- Expose `fs::create_dir_all`
11+
1012
# [0.99.4] - 2019-08-21
1113

1214
## Changes

src/fs/create_dir_all.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fs;
2-
use std::path::{Path, PathBuf};
2+
use std::path::Path;
33

4-
use crate::task::blocking;
54
use crate::io;
5+
use crate::task::blocking;
66

77
/// Creates a new, empty directory and all of its parents if they are missing.
88
///

src/fs/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub use std::fs::{FileType, Metadata, Permissions};
3232
pub use canonicalize::canonicalize;
3333
pub use copy::copy;
3434
pub use create_dir::create_dir;
35+
pub use create_dir_all::create_dir_all;
3536
pub use hard_link::hard_link;
3637
pub use metadata::metadata;
3738
pub use read::read;
@@ -49,6 +50,7 @@ pub use write::write;
4950
mod canonicalize;
5051
mod copy;
5152
mod create_dir;
53+
mod create_dir_all;
5254
mod dir_builder;
5355
mod dir_entry;
5456
mod file;

tests/io_timeout.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
use std::time::Duration;
2+
3+
use async_std::io;
4+
use async_std::task;
5+
6+
#[test]
7+
#[should_panic(expected = "timed out")]
8+
fn io_timeout_timedout() {
9+
task::block_on(async {
10+
io::timeout(Duration::from_secs(1), async {
11+
let stdin = io::stdin();
12+
let mut line = String::new();
13+
let _n = stdin.read_line(&mut line).await?;
14+
Ok(())
15+
})
16+
.await
17+
.unwrap(); // We should panic with a timeout error
18+
});
19+
}
20+
21+
#[test]
22+
#[should_panic(expected = "My custom error")]
23+
fn io_timeout_future_err() {
24+
task::block_on(async {
25+
io::timeout(Duration::from_secs(1), async {
26+
Err::<(), io::Error>(io::Error::new(io::ErrorKind::Other, "My custom error"))
27+
})
28+
.await
29+
.unwrap(); // We should panic with our own error
30+
});
31+
}
32+
33+
#[test]
34+
fn io_timeout_future_ok() {
35+
task::block_on(async {
36+
io::timeout(Duration::from_secs(1), async { Ok(()) })
37+
.await
38+
.unwrap(); // We shouldn't panic at all
39+
});
40+
}

0 commit comments

Comments
 (0)