Migrate build_the_dummy_book to BookTest (build::basic_build)

This doesn't exercise *everything* that the old test did, but other
tests will take care of those gaps. This is intended as just a smoke
test.
This commit is contained in:
Eric Huss 2025-04-21 18:25:43 -07:00
parent f10d23e893
commit b9e433710d
6 changed files with 25 additions and 9 deletions

View file

@ -40,15 +40,6 @@ const TOC_SECOND_LEVEL: &[&str] = &[
"2.1. Nested Chapter",
];
/// Make sure you can load the dummy book and build it without panicking.
#[test]
fn build_the_dummy_book() {
let temp = DummyBook::new().build().unwrap();
let md = MDBook::load(temp.path()).unwrap();
md.build().unwrap();
}
#[test]
fn by_default_mdbook_generates_rendered_content_in_the_book_directory() {
let temp = DummyBook::new().build().unwrap();

18
tests/testsuite/build.rs Normal file
View file

@ -0,0 +1,18 @@
//! General build tests.
//!
//! More specific tests should usually go into a module based on the feature.
//! This module should just have general build tests, or misc small things.
use crate::prelude::*;
// Simple smoke test that building works.
#[test]
fn basic_build() {
BookTest::from_dir("build/basic_build").run("build", |cmd| {
cmd.expect_stderr(str![[r#"
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
"#]]);
});
}

View file

@ -0,0 +1,2 @@
[book]
title = "basic_build"

View file

@ -0,0 +1,3 @@
# Summary
- [Chapter 1](./chapter_1.md)

View file

@ -0,0 +1 @@
# Chapter 1

View file

@ -3,6 +3,7 @@
//! See README.md for documentation.
mod book_test;
mod build;
mod prelude {
pub use crate::book_test::BookTest;