@@ -5,7 +5,7 @@ use sourcemap::{decode_data_url, DecodedMap, SourceMap, Token};
55
66#[ test]
77fn test_no_header ( ) {
8- let input: & [ _ ] = b "[1, 2, 3]";
8+ let input: & [ _ ] = br# "[1, 2, 3]"# ;
99 let mut reader = io:: BufReader :: new ( input) ;
1010 let mut text = String :: new ( ) ;
1111 reader. read_line ( & mut text) . ok ( ) ;
@@ -14,21 +14,21 @@ fn test_no_header() {
1414
1515#[ test]
1616fn test_no_header_object ( ) {
17- let input: & [ _ ] = b"{ \" x \" : [1, 2, 3]}";
17+ let input: & [ _ ] = br#"{"x": [1, 2, 3]}"# ;
1818 let mut reader = io:: BufReader :: new ( input) ;
1919 let mut text = String :: new ( ) ;
2020 reader. read_line ( & mut text) . ok ( ) ;
21- assert_eq ! ( text, "{ \" x \" : [1, 2, 3]}") ;
21+ assert_eq ! ( text, r#"{"x": [1, 2, 3]}"# ) ;
2222}
2323
2424#[ test]
2525fn test_basic_sourcemap ( ) {
26- let input: & [ _ ] = b "{
27- \ " version\" : 3,
28- \ " sources\" :[ \ " coolstuff.js\ " ],
29- \ " names\" :[ \" x \" , \ " alert\ " ],
30- \ " mappings\" : \ " AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM\ "
31- }" ;
26+ let input: & [ _ ] = br# "{
27+ "version": 3,
28+ "sources": [ "coolstuff.js"],
29+ "names": ["x", "alert"],
30+ "mappings": "AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM"
31+ }"# ;
3232 let sm = SourceMap :: from_reader ( input) . unwrap ( ) ;
3333 let mut iter = sm. tokens ( ) . filter ( Token :: has_name) ;
3434 assert_eq ! (
@@ -48,13 +48,13 @@ fn test_basic_sourcemap() {
4848
4949#[ test]
5050fn test_basic_sourcemap_with_root ( ) {
51- let input: & [ _ ] = b "{
52- \ " version\" : 3,
53- \ " sources\" :[ \ " coolstuff.js\ " ],
54- \ " sourceRoot\" : \" x \ " ,
55- \ " names\" :[ \" x \" , \ " alert\ " ],
56- \ " mappings\" : \ " AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM\ "
57- }" ;
51+ let input: & [ _ ] = br# "{
52+ "version": 3,
53+ "sources": [ "coolstuff.js"],
54+ "sourceRoot": "x ",
55+ "names": ["x", "alert"],
56+ "mappings": "AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM"
57+ }"# ;
5858 let sm = SourceMap :: from_reader ( input) . unwrap ( ) ;
5959 let mut iter = sm. tokens ( ) . filter ( Token :: has_name) ;
6060 assert_eq ! (
@@ -74,13 +74,13 @@ fn test_basic_sourcemap_with_root() {
7474
7575#[ test]
7676fn test_basic_sourcemap_with_absolute_uri_root ( ) {
77- let input: & [ _ ] = b "{
78- \ " version\" : 3,
79- \ " sources\" :[ \ " coolstuff.js\ " , \ " ./evencoolerstuff.js\ " ],
80- \ " sourceRoot\" : \ " webpack:///\ " ,
81- \ " names\" :[ \" x \" , \ " alert\ " ],
82- \ " mappings\" : \ " AAAA,GAAIA,GAAI,EACR,ICAIA,GAAK,EAAG,CACVC,MAAM\ "
83- }" ;
77+ let input: & [ _ ] = br# "{
78+ "version": 3,
79+ "sources": [ "coolstuff.js", "./evencoolerstuff.js"],
80+ "sourceRoot": "webpack:///",
81+ "names": ["x", "alert"],
82+ "mappings": "AAAA,GAAIA,GAAI,EACR,ICAIA,GAAK,EAAG,CACVC,MAAM"
83+ }"# ;
8484 let sm = SourceMap :: from_reader ( input) . unwrap ( ) ;
8585 let mut iter = sm. tokens ( ) . filter ( Token :: has_name) ;
8686 assert_eq ! (
@@ -129,12 +129,12 @@ fn test_sourcemap_data_url() {
129129
130130#[ test]
131131fn test_sourcemap_nofiles ( ) {
132- let input: & [ _ ] = b "{
133- \ " version\" : 3,
134- \ " sources\" : [null],
135- \ " names\" :[ \" x \" , \ " alert\ " ],
136- \ " mappings\" : \ " AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM\ "
137- }" ;
132+ let input: & [ _ ] = br# "{
133+ "version": 3,
134+ "sources": [null],
135+ "names": ["x", "alert"],
136+ "mappings": "AAAA,GAAIA,GAAI,EACR,IAAIA,GAAK,EAAG,CACVC,MAAM"
137+ }"# ;
138138 let sm = SourceMap :: from_reader ( input) . unwrap ( ) ;
139139 let mut iter = sm. tokens ( ) . filter ( Token :: has_name) ;
140140 assert_eq ! ( iter. next( ) . unwrap( ) . to_tuple( ) , ( "" , 0 , 4 , Some ( "x" ) ) ) ;
0 commit comments