Skip to content

Commit edeaea7

Browse files
authored
Merge pull request #819 from servo/wpt
Update urltestdata.json WPT test cases
2 parents b65a455 + d000efe commit edeaea7

File tree

2 files changed

+1240
-228
lines changed

2 files changed

+1240
-228
lines changed

url/tests/data.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,32 @@ use url::{quirks, Url};
1515

1616
#[test]
1717
fn urltestdata() {
18-
let idna_skip_inputs = [
19-
"http://www.foo。bar.com",
20-
"http://Go.com",
21-
"http://你好你好",
22-
"https://faß.ExAmPlE/",
23-
"http://0Xc0.0250.01",
24-
"ftp://%e2%98%83",
25-
"https://%e2%98%83",
26-
"file://a\u{ad}b/p",
27-
"file://a%C2%ADb/p",
28-
"http://GOO\u{200b}\u{2060}\u{feff}goo.com",
29-
];
30-
3118
// Copied from https://github.com/web-platform-tests/wpt/blob/master/url/
3219
let mut json = Value::from_str(include_str!("urltestdata.json"))
3320
.expect("JSON parse error in urltestdata.json");
3421

3522
let mut passed = true;
23+
let mut skip_next = false;
3624
for entry in json.as_array_mut().unwrap() {
3725
if entry.is_string() {
26+
if entry.as_str().unwrap() == "skip next" {
27+
skip_next = true;
28+
}
3829
continue; // ignore comments
3930
}
4031

32+
if skip_next {
33+
skip_next = false;
34+
continue;
35+
}
36+
4137
let maybe_base = entry
4238
.take_key("base")
4339
.expect("missing base key")
4440
.maybe_string();
4541
let input = entry.take_string("input");
4642
let failure = entry.take_key("failure").is_some();
4743

48-
{
49-
if idna_skip_inputs.contains(&input.as_str()) {
50-
continue;
51-
}
52-
}
53-
5444
let res = if let Some(base) = maybe_base {
5545
let base = match Url::parse(&base) {
5646
Ok(base) => base,

0 commit comments

Comments
 (0)