File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,29 @@ And here is some \
397397 assert_eq ! ( got, should_be) ;
398398 }
399399
400+ #[ test]
401+ fn load_a_single_chapter_with_utf8_bom_from_disk ( ) {
402+ let temp_dir = TempFileBuilder :: new ( ) . prefix ( "book" ) . tempdir ( ) . unwrap ( ) ;
403+
404+ let chapter_path = temp_dir. path ( ) . join ( "chapter_1.md" ) ;
405+ File :: create ( & chapter_path)
406+ . unwrap ( )
407+ . write_all ( ( "\u{feff} " . to_owned ( ) + DUMMY_SRC ) . as_bytes ( ) )
408+ . unwrap ( ) ;
409+
410+ let link = Link :: new ( "Chapter 1" , chapter_path) ;
411+
412+ let should_be = Chapter :: new (
413+ "Chapter 1" ,
414+ DUMMY_SRC . to_string ( ) ,
415+ "chapter_1.md" ,
416+ Vec :: new ( ) ,
417+ ) ;
418+
419+ let got = load_chapter ( & link, temp_dir. path ( ) , Vec :: new ( ) ) . unwrap ( ) ;
420+ assert_eq ! ( got, should_be) ;
421+ }
422+
400423 #[ test]
401424 fn cant_load_a_nonexistent_chapter ( ) {
402425 let link = Link :: new ( "Chapter 1" , "/foo/bar/baz.md" ) ;
You can’t perform that action at this time.
0 commit comments