Migrate book_toml_isnt_required to BookTest

This commit is contained in:
Eric Huss 2025-04-21 18:36:47 -07:00
parent 3706ddc5cc
commit ac3e4b6c1e
2 changed files with 12 additions and 10 deletions

View file

@ -98,16 +98,6 @@ fn run_mdbook_init_with_custom_book_and_src_locations() {
);
}
#[test]
fn book_toml_isnt_required() {
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
let md = MDBook::init(temp.path()).build().unwrap();
let _ = fs::remove_file(temp.path().join("book.toml"));
md.build().unwrap();
}
#[test]
fn copy_theme() {
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();

View file

@ -53,3 +53,15 @@ fn no_reserved_filename() {
"#]]);
});
}
// Build without book.toml should be OK.
#[test]
fn book_toml_isnt_required() {
let mut test = BookTest::init(|_| {});
std::fs::remove_file(test.dir.join("book.toml")).unwrap();
test.build();
test.check_main_file(
"book/chapter_1.html",
str![[r##"<h1 id="chapter-1"><a class="header" href="#chapter-1">Chapter 1</a></h1>"##]],
);
}