From 66a88d946b50c8100db11dc56df1cf5cac244f54 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 30 Apr 2019 23:11:10 +0200 Subject: [PATCH] Add doc-comment to test README examples (#515) --- Cargo.toml | 1 + README.md | 2 +- src/lib.rs | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ab45a33..f11e205 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ env_logger = "0.6" serde_derive = "1.0" tokio-tcp = "0.1" libflate = "0.1" +doc-comment = "0.3" [features] default = ["default-tls"] diff --git a/README.md b/README.md index 001a70d..6c1e36a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ An ergonomic, batteries-included HTTP Client for Rust. ## Example -```rust +```rust,no_run extern crate reqwest; use std::collections::HashMap; diff --git a/src/lib.rs b/src/lib.rs index abe98a1..0c2104c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -218,6 +218,12 @@ extern crate tokio_rustls; extern crate webpki_roots; #[cfg(feature = "rustls-tls")] extern crate rustls; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); pub use hyper::header; pub use hyper::Method;