Skip to content

Commit 9a1f983

Browse files
committed
Copy copy-fonts=false no theme to BookTest
1 parent c2c3770 commit 9a1f983

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-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, no theme
327-
// This should generate a deprecation warning.
328-
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
329-
let p = temp.path();
330-
MDBook::init(p).build().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 empty fonts.css
340327
let temp = TempFileBuilder::new().prefix("mdbook").tempdir().unwrap();
341328
let p = temp.path();

tests/testsuite/theme.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,21 @@ book/fonts/myfont.woff
137137
"#]],
138138
);
139139
}
140+
141+
// copy-fonts=false, no theme, deprecated
142+
#[test]
143+
fn copy_fonts_false_no_theme() {
144+
BookTest::from_dir("theme/copy_fonts_false_no_theme")
145+
.run("build", |cmd| {
146+
cmd.expect_stderr(str![[r#"
147+
[TIMESTAMP] [INFO] (mdbook::book): Book building has started
148+
[TIMESTAMP] [INFO] (mdbook::book): Running the html backend
149+
[TIMESTAMP] [WARN] (mdbook::renderer::html_handlebars::static_files): output.html.copy-fonts is deprecated.
150+
This book appears to have copy-fonts=false in book.toml without a fonts.css file.
151+
Add an empty `theme/fonts/fonts.css` file to squelch this warning.
152+
153+
"#]]);
154+
})
155+
.check_file_doesnt_contain("book/index.html", "fonts.css")
156+
.check_file_list("book/fonts", str![[""]]);
157+
}
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)

0 commit comments

Comments
 (0)