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:
parent
f10d23e893
commit
b9e433710d
6 changed files with 25 additions and 9 deletions
|
|
@ -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
18
tests/testsuite/build.rs
Normal 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
|
||||
|
||||
"#]]);
|
||||
});
|
||||
}
|
||||
2
tests/testsuite/build/basic_build/book.toml
Normal file
2
tests/testsuite/build/basic_build/book.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[book]
|
||||
title = "basic_build"
|
||||
3
tests/testsuite/build/basic_build/src/SUMMARY.md
Normal file
3
tests/testsuite/build/basic_build/src/SUMMARY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Summary
|
||||
|
||||
- [Chapter 1](./chapter_1.md)
|
||||
1
tests/testsuite/build/basic_build/src/chapter_1.md
Normal file
1
tests/testsuite/build/basic_build/src/chapter_1.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Chapter 1
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
//! See README.md for documentation.
|
||||
|
||||
mod book_test;
|
||||
mod build;
|
||||
|
||||
mod prelude {
|
||||
pub use crate::book_test::BookTest;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue