From 909bd1c54e5f4a1c05191bbe4731699a20acc426 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 22 Apr 2025 10:58:55 -0700 Subject: [PATCH] Migrate mdbook_test_chapter_not_found to BookTest --- tests/testing.rs | 13 ------------- tests/testsuite/test.rs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 tests/testing.rs diff --git a/tests/testing.rs b/tests/testing.rs deleted file mode 100644 index 8ab16c3d..00000000 --- a/tests/testing.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod dummy_book; - -use crate::dummy_book::DummyBook; - -use mdbook::MDBook; - -#[test] -fn mdbook_test_chapter_not_found() { - let temp = DummyBook::new().with_passing_test(true).build().unwrap(); - let mut md = MDBook::load(temp.path()).unwrap(); - - assert!(md.test_chapter(vec![], Some("Bogus Chapter Name")).is_err()); -} diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index c5f4530a..54be8695 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -74,3 +74,16 @@ fn test_individual_chapter() { "#]]); }); } + +// Unknown chapter name. +#[test] +fn chapter_not_found() { + BookTest::from_dir("test/passing_tests").run("test -c bogus", |cmd| { + cmd.expect_failure() + .expect_stdout(str![[""]]) + .expect_stderr(str![[r#" +[TIMESTAMP] [ERROR] (mdbook::utils): Error: Chapter not found: bogus + +"#]]); + }); +}