@@ -2,6 +2,7 @@ use super::write_code;
2
2
use crate :: html:: format:: Buffer ;
3
3
use expect_test:: expect_file;
4
4
use rustc_span:: edition:: Edition ;
5
+ use rustc_span:: with_default_session_globals;
5
6
6
7
const STYLE : & str = r#"
7
8
<style>
@@ -17,21 +18,25 @@ const STYLE: &str = r#"
17
18
18
19
#[ test]
19
20
fn 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
+ } ) ;
27
30
}
28
31
29
32
#[ test]
30
33
fn test_dos_backline ( ) {
31
- let src = "pub fn foo() {\r \n \
34
+ with_default_session_globals ( || {
35
+ let src = "pub fn foo() {\r \n \
32
36
println!(\" foo\" );\r \n \
33
37
}\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
+ } ) ;
37
42
}
0 commit comments