@@ -2,6 +2,7 @@ use super::write_code;
22use crate :: html:: format:: Buffer ;
33use expect_test:: expect_file;
44use rustc_span:: edition:: Edition ;
5+ use rustc_span:: with_default_session_globals;
56
67const STYLE : & str = r#"
78<style>
@@ -17,21 +18,25 @@ const STYLE: &str = r#"
1718
1819#[ test]
1920fn test_html_highlighting ( ) {
20- let src = include_str ! ( "fixtures/sample.rs" ) ;
21- let html = {
22- let mut out = Buffer :: new ( ) ;
23- write_code ( & mut out, src, Edition :: Edition2018 ) ;
24- format ! ( "{}<pre><code>{}</code></pre>\n " , STYLE , out. into_inner( ) )
25- } ;
26- expect_file ! [ "fixtures/sample.html" ] . assert_eq ( & html) ;
21+ with_default_session_globals ( || {
22+ let src = include_str ! ( "fixtures/sample.rs" ) ;
23+ let html = {
24+ let mut out = Buffer :: new ( ) ;
25+ write_code ( & mut out, src, Edition :: Edition2018 ) ;
26+ format ! ( "{}<pre><code>{}</code></pre>\n " , STYLE , out. into_inner( ) )
27+ } ;
28+ expect_file ! [ "fixtures/sample.html" ] . assert_eq ( & html) ;
29+ } ) ;
2730}
2831
2932#[ test]
3033fn test_dos_backline ( ) {
31- let src = "pub fn foo() {\r \n \
34+ with_default_session_globals ( || {
35+ let src = "pub fn foo() {\r \n \
3236 println!(\" foo\" );\r \n \
3337 }\r \n ";
34- let mut html = Buffer :: new ( ) ;
35- write_code ( & mut html, src, Edition :: Edition2018 ) ;
36- expect_file ! [ "fixtures/dos_line.html" ] . assert_eq ( & html. into_inner ( ) ) ;
38+ let mut html = Buffer :: new ( ) ;
39+ write_code ( & mut html, src, Edition :: Edition2018 ) ;
40+ expect_file ! [ "fixtures/dos_line.html" ] . assert_eq ( & html. into_inner ( ) ) ;
41+ } ) ;
3742}
0 commit comments