Migrate copy-fonts=false empty fonts.css to BookTest
This commit is contained in:
parent
9a1f983e65
commit
bdd16e25fa
5 changed files with 18 additions and 13 deletions
|
|
@ -323,19 +323,6 @@ fn custom_fonts() {
|
||||||
contents.contains("fonts/fonts.css")
|
contents.contains("fonts/fonts.css")
|
||||||
};
|
};
|
||||||
|
|
||||||
// copy-fonts=false with empty fonts.css
|
|
||||||
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
|
|
||||||
let p = temp.path();
|
|
||||||
MDBook::init(p).build().unwrap();
|
|
||||||
write_file(&p.join("theme/fonts"), "fonts.css", b"").unwrap();
|
|
||||||
let config = Config::from_str("output.html.copy-fonts = false").unwrap();
|
|
||||||
MDBook::load_with_config(p, config)
|
|
||||||
.unwrap()
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
assert!(!has_fonts_css(p));
|
|
||||||
assert!(!p.join("book/fonts").exists());
|
|
||||||
|
|
||||||
// copy-fonts=false with fonts theme
|
// copy-fonts=false with fonts theme
|
||||||
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
|
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
|
||||||
let p = temp.path();
|
let p = temp.path();
|
||||||
|
|
|
||||||
|
|
@ -155,3 +155,18 @@ Add an empty `theme/fonts/fonts.css` file to squelch this warning.
|
||||||
.check_file_doesnt_contain("book/index.html", "fonts.css")
|
.check_file_doesnt_contain("book/index.html", "fonts.css")
|
||||||
.check_file_list("book/fonts", str![[""]]);
|
.check_file_list("book/fonts", str![[""]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copy-fonts=false, empty fonts.css
|
||||||
|
#[test]
|
||||||
|
fn copy_fonts_false_with_empty_fonts_css() {
|
||||||
|
BookTest::from_dir("theme/copy_fonts_false_with_empty_fonts_css")
|
||||||
|
.run("build", |cmd| {
|
||||||
|
cmd.expect_stderr(str![[r#"
|
||||||
|
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
|
||||||
|
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
|
||||||
|
|
||||||
|
"#]]);
|
||||||
|
})
|
||||||
|
.check_file_doesnt_contain("book/index.html", "fonts.css")
|
||||||
|
.check_file_list("book/fonts", str![[""]]);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
[output.html]
|
||||||
|
copy-fonts = false
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
- [Intro](index.md)
|
||||||
Loading…
Add table
Reference in a new issue