Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit be4885a

Browse files
committed
Auto merge of #2 - killercup:feature/doctest, r=killercup
Enable Doc Tests for Macros
2 parents ce24b54 + cc16c8f commit be4885a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ dev = ["clippy"]
1616
[dependencies]
1717
ansi_term = "0.6.3"
1818
difference = "0.4.0"
19-
clippy = {version = "0.0.21", optional = true}
19+
clippy = {version = "0.0.23", optional = true}

src/lib.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
//!
2929
//! Alternatively, you can use the `assert_cli!` macro:
3030
//!
31-
//! ```rust,ignore
32-
//! assert_cli!("echo 42" => Success, "42").unwrap();
31+
//! ```rust
32+
//! # #[macro_use] extern crate assert_cli;
33+
//! # fn main() {
34+
//! assert_cli!("echo", &["42"] => Success, "42").unwrap();
35+
//! # }
3336
//! ```
3437
//!
3538
//! Make sure to include the crate as `#[macro_use] extern crate assert_cli;`.
@@ -161,9 +164,15 @@ pub fn assert_cli_output_error<S>(cmd: &str,
161164
/// The `assert_cli!` macro combines the functionality of the other functions in this crate in one
162165
/// short macro.
163166
///
164-
/// ```rust,ignore
165-
/// assert_cli!("echo 42" => Success, "42").unwrap();
166-
/// assert_cli!("exit 11" => Error 11, "").unwrap();
167+
/// ```rust
168+
/// #[macro_use] extern crate assert_cli;
169+
/// # const BLACK_BOX: &'static str = r#"function test_helper() {\
170+
/// # >&2 echo "error no 66!"; return 66; }; test_helper"#;
171+
///
172+
/// fn main() {
173+
/// assert_cli!("echo", &["42"] => Success, "42").unwrap();
174+
/// assert_cli!("bash", &["-c", BLACK_BOX] => Error 66, "error no 66!").unwrap();
175+
/// }
167176
/// ```
168177
///
169178
/// Make sure to include the crate as `#[macro_use] extern crate assert_cli;`.

0 commit comments

Comments
 (0)