File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: cli:: cmd:: mdbook_cmd;
1
2
use crate :: dummy_book:: DummyBook ;
2
3
3
- use assert_cmd:: Command ;
4
-
5
4
#[ test]
6
5
fn mdbook_cli_dummy_book_generates_index_html ( ) {
7
6
let temp = DummyBook :: new ( ) . build ( ) . unwrap ( ) ;
8
7
9
8
// doesn't exist before
10
9
assert ! ( !temp. path( ) . join( "book" ) . exists( ) ) ;
11
10
12
- let mut cmd = Command :: cargo_bin ( "mdbook" ) . unwrap ( ) ;
11
+ let mut cmd = mdbook_cmd ( ) ;
13
12
cmd. arg ( "build" ) . current_dir ( temp. path ( ) ) ;
14
13
cmd. assert ( )
15
14
. success ( )
Original file line number Diff line number Diff line change
1
+ use assert_cmd:: Command ;
2
+
3
+ pub ( crate ) fn mdbook_cmd ( ) -> Command {
4
+ let mut cmd = Command :: cargo_bin ( "mdbook" ) . unwrap ( ) ;
5
+ cmd. env_remove ( "RUST_LOG" ) ;
6
+ cmd
7
+ }
Original file line number Diff line number Diff line change 1
1
mod build;
2
+ mod cmd;
2
3
mod test;
Original file line number Diff line number Diff line change
1
+ use crate :: cli:: cmd:: mdbook_cmd;
1
2
use crate :: dummy_book:: DummyBook ;
2
3
3
- use assert_cmd:: Command ;
4
4
use predicates:: boolean:: PredicateBooleanExt ;
5
5
6
6
#[ test]
7
7
fn mdbook_cli_can_correctly_test_a_passing_book ( ) {
8
8
let temp = DummyBook :: new ( ) . with_passing_test ( true ) . build ( ) . unwrap ( ) ;
9
9
10
- let mut cmd = Command :: cargo_bin ( "mdbook" ) . unwrap ( ) ;
10
+ let mut cmd = mdbook_cmd ( ) ;
11
11
cmd. arg ( "test" ) . current_dir ( temp. path ( ) ) ;
12
12
cmd. assert ( ) . success ( )
13
13
. stderr ( predicates:: str:: is_match ( r##"Testing file: "([^"]+)[\\/]README.md""## ) . unwrap ( ) )
@@ -22,7 +22,7 @@ fn mdbook_cli_can_correctly_test_a_passing_book() {
22
22
fn mdbook_cli_detects_book_with_failing_tests ( ) {
23
23
let temp = DummyBook :: new ( ) . with_passing_test ( false ) . build ( ) . unwrap ( ) ;
24
24
25
- let mut cmd = Command :: cargo_bin ( "mdbook" ) . unwrap ( ) ;
25
+ let mut cmd = mdbook_cmd ( ) ;
26
26
cmd. arg ( "test" ) . current_dir ( temp. path ( ) ) ;
27
27
cmd. assert ( ) . failure ( )
28
28
. stderr ( predicates:: str:: is_match ( r##"Testing file: "([^"]+)[\\/]README.md""## ) . unwrap ( ) )
You can’t perform that action at this time.
0 commit comments