Skip to content

Commit bdd16e2

Browse files
committed
Migrate copy-fonts=false empty fonts.css to BookTest
1 parent 9a1f983 commit bdd16e2

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

tests/rendered_output.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -323,19 +323,6 @@ fn custom_fonts() {
323323
contents.contains("fonts/fonts.css")
324324
};
325325

326-
// copy-fonts=false with empty fonts.css
327-
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
328-
let p = temp.path();
329-
MDBook::init(p).build().unwrap();
330-
write_file(&p.join("theme/fonts"), "fonts.css", b"").unwrap();
331-
let config = Config::from_str("output.html.copy-fonts = false").unwrap();
332-
MDBook::load_with_config(p, config)
333-
.unwrap()
334-
.build()
335-
.unwrap();
336-
assert!(!has_fonts_css(p));
337-
assert!(!p.join("book/fonts").exists());
338-
339326
// copy-fonts=false with fonts theme
340327
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
341328
let p = temp.path();

tests/testsuite/theme.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,18 @@ Add an empty `theme/fonts/fonts.css` file to squelch this warning.
155155
.check_file_doesnt_contain("book/index.html", "fonts.css")
156156
.check_file_list("book/fonts", str![[""]]);
157157
}
158+
159+
// copy-fonts=false, empty fonts.css
160+
#[test]
161+
fn copy_fonts_false_with_empty_fonts_css() {
162+
BookTest::from_dir("theme/copy_fonts_false_with_empty_fonts_css")
163+
.run("build", |cmd| {
164+
cmd.expect_stderr(str![[r#"
165+
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
166+
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
167+
168+
"#]]);
169+
})
170+
.check_file_doesnt_contain("book/index.html", "fonts.css")
171+
.check_file_list("book/fonts", str![[""]]);
172+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[output.html]
2+
copy-fonts = false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [Intro](index.md)

tests/testsuite/theme/copy_fonts_false_with_empty_fonts_css/theme/fonts/fonts.css

Whitespace-only changes.

0 commit comments

Comments
 (0)