Migrate recursive_includes_are_capped to BookTest
This commit is contained in:
parent
7add0dbf10
commit
9952ac15a5
2 changed files with 30 additions and 14 deletions
|
|
@ -350,20 +350,6 @@ fn able_to_include_playground_files_in_chapters() {
|
||||||
assert_doesnt_contain_strings(&second, &["{{#playground example.rs}}"]);
|
assert_doesnt_contain_strings(&second, &["{{#playground example.rs}}"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure cyclic includes are capped so that no exceptions occur
|
|
||||||
#[test]
|
|
||||||
fn recursive_includes_are_capped() {
|
|
||||||
let temp = DummyBook::new().build().unwrap();
|
|
||||||
let md = MDBook::load(temp.path()).unwrap();
|
|
||||||
md.build().unwrap();
|
|
||||||
|
|
||||||
let recursive = temp.path().join("book/first/recursive.html");
|
|
||||||
let content = &["Around the world, around the world
|
|
||||||
Around the world, around the world
|
|
||||||
Around the world, around the world"];
|
|
||||||
assert_contains_strings(recursive, content);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn example_book_can_build() {
|
fn example_book_can_build() {
|
||||||
let example_book_dir = dummy_book::new_copy_of_example_book().unwrap();
|
let example_book_dir = dummy_book::new_copy_of_example_book().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -38,3 +38,33 @@ fn anchored_include() {
|
||||||
"##]],
|
"##]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checks behavior of recursive include.
|
||||||
|
#[test]
|
||||||
|
fn recursive_include() {
|
||||||
|
BookTest::from_dir("includes/all_includes")
|
||||||
|
.run("build", |cmd| {
|
||||||
|
cmd.expect_stderr(str![[r#"
|
||||||
|
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
|
||||||
|
[TIMESTAMP] [ERROR] (mdbook::preprocess::links): Stack depth exceeded in recursive.md. Check for cyclic includes
|
||||||
|
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
|
||||||
|
|
||||||
|
"#]]);
|
||||||
|
})
|
||||||
|
.check_main_file(
|
||||||
|
"book/recursive.html",
|
||||||
|
str![[r#"
|
||||||
|
<p>Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world
|
||||||
|
Around the world, around the world</p>
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue