File tree Expand file tree Collapse file tree 5 files changed +22
-35
lines changed Expand file tree Collapse file tree 5 files changed +22
-35
lines changed Original file line number Diff line number Diff line change @@ -324,41 +324,6 @@ fn summary_with_markdown_formatting() {
324324 ) ;
325325}
326326
327- /// Ensure building fails if `[output.html].theme` points to a non-existent directory
328- #[ test]
329- fn failure_on_missing_theme_directory ( ) {
330- // 1. Using default theme should work
331- let temp = DummyBook :: new ( ) . build ( ) . unwrap ( ) ;
332- let book_toml = r#"
333- [book]
334- title = "implicit"
335- src = "src"
336- "# ;
337-
338- write_file ( temp. path ( ) , "book.toml" , book_toml. as_bytes ( ) ) . unwrap ( ) ;
339- let md = MDBook :: load ( temp. path ( ) ) . unwrap ( ) ;
340- let got = md. build ( ) ;
341- assert ! ( got. is_ok( ) ) ;
342-
343- // 2. Pointing to a normal directory should work
344- let temp = DummyBook :: new ( ) . build ( ) . unwrap ( ) ;
345- let created = fs:: create_dir ( temp. path ( ) . join ( "theme-directory" ) ) ;
346- assert ! ( created. is_ok( ) ) ;
347- let book_toml = r#"
348- [book]
349- title = "implicit"
350- src = "src"
351-
352- [output.html]
353- theme = "./theme-directory"
354- "# ;
355-
356- write_file ( temp. path ( ) , "book.toml" , book_toml. as_bytes ( ) ) . unwrap ( ) ;
357- let md = MDBook :: load ( temp. path ( ) ) . unwrap ( ) ;
358- let got = md. build ( ) ;
359- assert ! ( got. is_ok( ) ) ;
360- }
361-
362327#[ test]
363328fn custom_fonts ( ) {
364329 // Tests to ensure custom fonts are copied as expected.
Original file line number Diff line number Diff line change @@ -17,3 +17,16 @@ cmd.expect_failure()
1717"# ] ] ) ;
1818 } ) ;
1919}
20+
21+ // Checks what happens if the theme directory is empty.
22+ #[ test]
23+ fn empty_theme ( ) {
24+ BookTest :: from_dir ( "theme/empty_theme" ) . run ( "build" , |cmd| {
25+ std:: fs:: create_dir ( cmd. dir . join ( "theme" ) ) . unwrap ( ) ;
26+ cmd. expect_stderr ( str![ [ r#"
27+ [TIMESTAMP] [INFO] (mdbook::book): Book building has started
28+ [TIMESTAMP] [INFO] (mdbook::book): Running the html backend
29+
30+ "# ] ] ) ;
31+ } ) ;
32+ }
Original file line number Diff line number Diff line change 1+ [book ]
2+ title = " empty_theme"
3+
4+ [output .html ]
5+ theme = " ./theme"
Original file line number Diff line number Diff line change 1+ # Summary
2+
3+ - [ Chapter 1] ( ./chapter_1.md )
Original file line number Diff line number Diff line change 1+ # Chapter 1
You can’t perform that action at this time.
0 commit comments