From 11b1e86187d90266255411f2601a30607e2e94cf Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 13 Jul 2021 17:09:49 -0700 Subject: [PATCH] Fix path dumps under windows --- tests/cli.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index c400ff11..9fc8b498 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -12,10 +12,10 @@ fn mdbook_cli_can_correctly_test_a_passing_book() { let mut cmd = Command::cargo_bin("mdbook").unwrap(); cmd.arg("test").current_dir(temp.path()); cmd.assert().success() - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/src/README.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/src/intro.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/first/index.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/first/nested.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]README.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]intro.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]first[\\/]index.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]first[\\/]nested.md""##).unwrap()) .stderr(predicates::str::is_match(r##"rustdoc returned an error:\n\n"##).unwrap().not()) .stderr(predicates::str::is_match(r##"Nested_Chapter::Rustdoc_include_works_with_anchors_too \(line \d+\) ... FAILED"##).unwrap().not()); } @@ -27,10 +27,10 @@ fn mdbook_cli_detects_book_with_failing_tests() { let mut cmd = Command::cargo_bin("mdbook").unwrap(); cmd.arg("test").current_dir(temp.path()); cmd.assert().failure() - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/src/README.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/src/intro.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/first/index.md""##).unwrap()) - .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)/first/nested.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]README.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]intro.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]first[\\/]index.md""##).unwrap()) + .stderr(predicates::str::is_match(r##"Testing file: "([^"]+)[\\/]first[\\/]nested.md""##).unwrap()) .stderr(predicates::str::is_match(r##"rustdoc returned an error:\n\n"##).unwrap()) .stderr(predicates::str::is_match(r##"Nested_Chapter::Rustdoc_include_works_with_anchors_too \(line \d+\) ... FAILED"##).unwrap()); } @@ -46,9 +46,10 @@ fn mdbook_cli_dummy_book_generates_index_html() { cmd.arg("build").current_dir(temp.path()); cmd.assert() .success() - .stderr(predicates::str::contains( - r##"[ERROR] (mdbook::preprocess::links): Stack depth exceeded in first/recursive.md."##, - )) + .stderr( + predicates::str::is_match(r##"Stack depth exceeded in first[\\/]recursive.md."##) + .unwrap(), + ) .stderr(predicates::str::contains( r##"[INFO] (mdbook::book): Running the html backend"##, ));