We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f2402b commit 9512b55Copy full SHA for 9512b55
data-url/tests/wpt.rs
@@ -1,7 +1,18 @@
1
#[macro_use]
2
extern crate serde;
3
4
-fn run_data_url(input: String, expected_mime: Option<String>, expected_body: Option<Vec<u8>>) {
+fn run_data_url(
5
+ input: String,
6
+ expected_mime: Option<String>,
7
+ expected_body: Option<Vec<u8>>,
8
+ expected_panic: bool,
9
+) {
10
+ let priorhook = std::panic::take_hook();
11
+ std::panic::set_hook(Box::new(move |p| {
12
+ if !expected_panic {
13
+ priorhook(p);
14
+ }
15
+ }));
16
let url = data_url::DataUrl::process(&input);
17
if let Some(expected_mime) = expected_mime {
18
let url = url.unwrap();
@@ -43,7 +54,7 @@ where
43
54
format!("data: URL {:?}", input),
44
55
should_panic,
45
56
rustc_test::TestFn::dyn_test_fn(move || {
46
- run_data_url(input, expected_mime, expected_body)
57
+ run_data_url(input, expected_mime, expected_body, should_panic)
47
58
}),
48
59
);
49
60
}
0 commit comments