@@ -29,9 +29,8 @@ mod passing {
29
29
// STDOUT should contain isolated HTML
30
30
assert_eq ! (
31
31
String :: from_utf8_lossy( & out. stdout) ,
32
- "<html><head>\
33
- <meta http-equiv=\" Content-Security-Policy\" content=\" default-src 'unsafe-eval' 'unsafe-inline' data:;\" ></meta>\
34
- </head><body>Hello, World!</body></html>\n "
32
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-eval' 'unsafe-inline' data:;"></meta></head><body>Hello, World!</body></html>
33
+ "#
35
34
) ;
36
35
37
36
// Exit code should be 0
@@ -54,10 +53,8 @@ mod passing {
54
53
// STDOUT should contain HTML with no CSS
55
54
assert_eq ! (
56
55
String :: from_utf8_lossy( & out. stdout) ,
57
- "<html><head>\
58
- <meta http-equiv=\" Content-Security-Policy\" content=\" style-src 'none';\" ></meta>\
59
- <style></style>\
60
- </head><body>Hello</body></html>\n "
56
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="style-src 'none';"></meta><style></style></head><body>Hello</body></html>
57
+ "#
61
58
) ;
62
59
63
60
// Exit code should be 0
@@ -80,10 +77,8 @@ mod passing {
80
77
// STDOUT should contain HTML with no web fonts
81
78
assert_eq ! (
82
79
String :: from_utf8_lossy( & out. stdout) ,
83
- "<html><head>\
84
- <meta http-equiv=\" Content-Security-Policy\" content=\" font-src 'none';\" ></meta>\
85
- <style></style>\
86
- </head><body>Hi</body></html>\n "
80
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="font-src 'none';"></meta><style></style></head><body>Hi</body></html>
81
+ "#
87
82
) ;
88
83
89
84
// Exit code should be 0
@@ -96,7 +91,7 @@ mod passing {
96
91
let out = cmd
97
92
. arg ( "-M" )
98
93
. arg ( "-f" )
99
- . arg ( "data:text/html,<iframe src=\ " https://duckduckgo.com\ " ></iframe>Hi" )
94
+ . arg ( r# "data:text/html,<iframe src="https://duckduckgo.com"></iframe>Hi"# )
100
95
. output ( )
101
96
. unwrap ( ) ;
102
97
@@ -106,9 +101,8 @@ mod passing {
106
101
// STDOUT should contain HTML with no iframes
107
102
assert_eq ! (
108
103
String :: from_utf8_lossy( & out. stdout) ,
109
- "<html><head>\
110
- <meta http-equiv=\" Content-Security-Policy\" content=\" frame-src 'none'; child-src 'none';\" ></meta>\
111
- </head><body><iframe src=\" \" ></iframe>Hi</body></html>\n "
104
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="frame-src 'none'; child-src 'none';"></meta></head><body><iframe src=""></iframe>Hi</body></html>
105
+ "#
112
106
) ;
113
107
114
108
// Exit code should be 0
@@ -132,15 +126,8 @@ mod passing {
132
126
assert_eq ! (
133
127
String :: from_utf8_lossy( & out. stdout) ,
134
128
format!(
135
- "<html>\
136
- <head>\
137
- <meta http-equiv=\" Content-Security-Policy\" content=\" img-src data:;\" ></meta>\
138
- </head>\
139
- <body>\
140
- <img src=\" {empty_image}\" >\
141
- Hi\
142
- </body>\
143
- </html>\n ",
129
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="img-src data:;"></meta></head><body><img src="{empty_image}">Hi</body></html>
130
+ "# ,
144
131
empty_image =EMPTY_IMAGE_DATA_URL ,
145
132
)
146
133
) ;
@@ -165,12 +152,8 @@ mod passing {
165
152
// STDOUT should contain HTML with no JS
166
153
assert_eq ! (
167
154
String :: from_utf8_lossy( & out. stdout) ,
168
- "<html>\
169
- <head>\
170
- <meta http-equiv=\" Content-Security-Policy\" content=\" script-src 'none';\" ></meta>\
171
- <script></script></head>\
172
- <body>Hi</body>\
173
- </html>\n "
155
+ r#"<html><head><meta http-equiv="Content-Security-Policy" content="script-src 'none';"></meta><script></script></head><body>Hi</body></html>
156
+ "#
174
157
) ;
175
158
176
159
// Exit code should be 0
@@ -211,7 +194,7 @@ mod failing {
211
194
let mut cmd =Command :: cargo_bin ( env ! ( "CARGO_PKG_NAME" ) ) . unwrap ( ) ;
212
195
let out = cmd
213
196
. arg ( "-M" )
214
- . arg ( "data:text/html,%3Cscript%20src=\ " src/tests/data/basic/local-script.js\ " %3E%3C/script%3E" )
197
+ . arg ( r# "data:text/html,%3Cscript%20src="src/tests/data/basic/local-script.js"%3E%3C/script%3E"# )
215
198
. output ( )
216
199
. unwrap ( ) ;
217
200