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

Commit cc16c8f

Browse files
committed
feat(tests): Enable Doc Tests for Macros
1 parent 1d4b6de commit cc16c8f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

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)