File tree Expand file tree Collapse file tree 6 files changed +29
-16
lines changed Expand file tree Collapse file tree 6 files changed +29
-16
lines changed Original file line number Diff line number Diff line change @@ -357,22 +357,6 @@ fn failure_on_missing_theme_directory() {
357357 let md = MDBook :: load ( temp. path ( ) ) . unwrap ( ) ;
358358 let got = md. build ( ) ;
359359 assert ! ( got. is_ok( ) ) ;
360-
361- // 3. Pointing to a non-existent directory should fail
362- let temp = DummyBook :: new ( ) . build ( ) . unwrap ( ) ;
363- let book_toml = r#"
364- [book]
365- title = "implicit"
366- src = "src"
367-
368- [output.html]
369- theme = "./non-existent-directory"
370- "# ;
371-
372- write_file ( temp. path ( ) , "book.toml" , book_toml. as_bytes ( ) ) . unwrap ( ) ;
373- let md = MDBook :: load ( temp. path ( ) ) . unwrap ( ) ;
374- let got = md. build ( ) ;
375- assert ! ( got. is_err( ) ) ;
376360}
377361
378362#[ test]
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ mod rendering;
1818#[ cfg( feature = "search" ) ]
1919mod search;
2020mod test;
21+ mod theme;
2122
2223mod prelude {
2324 pub use crate :: book_test:: BookTest ;
Original file line number Diff line number Diff line change 1+ //! Tests for theme handling.
2+
3+ use crate :: prelude:: * ;
4+
5+ // Checks what happens if the theme directory is missing.
6+ #[ test]
7+ fn missing_theme ( ) {
8+ BookTest :: from_dir ( "theme/missing_theme" )
9+ . run ( "build" , |cmd| {
10+ cmd. expect_failure ( )
11+ . expect_stderr ( str![ [ r#"
12+ [TIMESTAMP] [INFO] (mdbook::book): Book building has started
13+ [TIMESTAMP] [INFO] (mdbook::book): Running the html backend
14+ [TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed
15+ [TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: theme dir [ROOT]/./non-existent-directory does not exist
16+
17+ "# ] ] ) ;
18+ } ) ;
19+ }
Original file line number Diff line number Diff line change 1+ [book ]
2+ title = " missing_theme"
3+
4+ [output .html ]
5+ theme = " ./non-existent-directory"
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