2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-04-08 17:36:43 +00:00

Merge pull request #597 from k-nasa/fix_doc_test

Fix failed doc test and enable doc test on CI
This commit is contained in:
Yoshua Wuyts 2019-12-13 15:03:22 +01:00 committed by GitHub
commit 83a488b290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View file

@ -63,7 +63,13 @@ jobs:
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: test command: test
args: --all --features unstable attributes args: --all --features "unstable attributes"
- name: documentation test
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --features "unstable attributes"
check_fmt_and_docs: check_fmt_and_docs:
name: Checking fmt and docs name: Checking fmt and docs

View file

@ -152,6 +152,8 @@
//! Await two futures concurrently, and return a tuple of their output: //! Await two futures concurrently, and return a tuple of their output:
//! //!
//! ``` //! ```
//! use async_std::prelude::*;
//!
//! #[async_std::main] //! #[async_std::main]
//! async fn main() { //! async fn main() {
//! let a = async { 1u8 }; //! let a = async { 1u8 };
@ -167,7 +169,7 @@
//! //!
//! #[async_std::main] //! #[async_std::main]
//! async fn main() -> std::io::Result<()> { //! async fn main() -> std::io::Result<()> {
//! let mut socket = UdpSocket::bind("127.0.0.1:8080")?; //! let socket = UdpSocket::bind("127.0.0.1:8080").await?;
//! println!("Listening on {}", socket.local_addr()?); //! println!("Listening on {}", socket.local_addr()?);
//! //!
//! let mut buf = vec![0u8; 1024]; //! let mut buf = vec![0u8; 1024];

View file

@ -350,7 +350,7 @@ extension_trait! {
assert!(start.elapsed().as_millis() >= 15); assert!(start.elapsed().as_millis() >= 15);
s.next().await; s.next().await;
assert!(start.elapsed().as_millis() >= 35); assert!(start.elapsed().as_millis() >= 25);
# #
# }) } # }) }
``` ```

View file

@ -8,7 +8,7 @@ fn open_file() {
match res { match res {
Ok(_) => panic!("Found file with random name: We live in a simulation"), Ok(_) => panic!("Found file with random name: We live in a simulation"),
Err(e) => assert_eq!( Err(e) => assert_eq!(
"Could not open `/ashjudlkahasdasdsikdhajik/asdasdasdasdasdasd/fjuiklashdbflasas`", "could not open `/ashjudlkahasdasdsikdhajik/asdasdasdasdasdasd/fjuiklashdbflasas`",
&format!("{}", e) &format!("{}", e)
), ),
} }