| 1 |
//! Basic tests for mdbook's CLI. |
| 2 |
|
| 3 |
use crate::prelude::*; |
| 4 |
use snapbox::file; |
| 5 |
|
| 6 |
// Test with no args. |
| 7 |
#[test] |
| 8 |
#[cfg_attr( |
| 9 |
not(all(feature = "watch", feature = "serve")), |
| 10 |
ignore = "needs all features" |
| 11 |
)] |
| 12 |
fn no_args() { |
| 13 |
BookTest::empty().run("", |cmd| { |
| 14 |
cmd.expect_code(2) |
| 15 |
.expect_stdout(str![[""]]) |
| 16 |
.expect_stderr(file!["cli/no_args.term.svg"]); |
| 17 |
}); |
| 18 |
} |
| 19 |
|
| 20 |
// Help command. |
| 21 |
#[test] |
| 22 |
#[cfg_attr( |
| 23 |
not(all(feature = "watch", feature = "serve")), |
| 24 |
ignore = "needs all features" |
| 25 |
)] |
| 26 |
fn help() { |
| 27 |
BookTest::empty() |
| 28 |
.run("help", |cmd| { |
| 29 |
cmd.expect_stdout(file!["cli/help.term.svg"]) |
| 30 |
.expect_stderr(str![[""]]); |
| 31 |
}) |
| 32 |
.run("--help", |cmd| { |
| 33 |
cmd.expect_stdout(file!["cli/help.term.svg"]) |
| 34 |
.expect_stderr(str![[""]]); |
| 35 |
}); |
| 36 |
} |