Prechádzať zdrojové kódy

Merge pull request #819 from servo/wpt

Update urltestdata.json WPT test cases
Valentin Gosu 3 rokov pred
rodič
commit
edeaea7f1e
2 zmenil súbory, kde vykonal 677 pridanie a 179 odobranie
  1. 9 19
      url/tests/data.rs
  2. 668 160
      url/tests/urltestdata.json

+ 9 - 19
url/tests/data.rs

@@ -15,29 +15,25 @@ use url::{quirks, Url};
 
 
 #[test]
 #[test]
 fn urltestdata() {
 fn urltestdata() {
-    let idna_skip_inputs = [
-        "http://www.foo。bar.com",
-        "http://Go.com",
-        "http://你好你好",
-        "https://faß.ExAmPlE/",
-        "http://0Xc0.0250.01",
-        "ftp://%e2%98%83",
-        "https://%e2%98%83",
-        "file://a\u{ad}b/p",
-        "file://a%C2%ADb/p",
-        "http://GOO\u{200b}\u{2060}\u{feff}goo.com",
-    ];
-
     // Copied from https://github.com/web-platform-tests/wpt/blob/master/url/
     // Copied from https://github.com/web-platform-tests/wpt/blob/master/url/
     let mut json = Value::from_str(include_str!("urltestdata.json"))
     let mut json = Value::from_str(include_str!("urltestdata.json"))
         .expect("JSON parse error in urltestdata.json");
         .expect("JSON parse error in urltestdata.json");
 
 
     let mut passed = true;
     let mut passed = true;
+    let mut skip_next = false;
     for entry in json.as_array_mut().unwrap() {
     for entry in json.as_array_mut().unwrap() {
         if entry.is_string() {
         if entry.is_string() {
+            if entry.as_str().unwrap() == "skip next" {
+                skip_next = true;
+            }
             continue; // ignore comments
             continue; // ignore comments
         }
         }
 
 
+        if skip_next {
+            skip_next = false;
+            continue;
+        }
+
         let maybe_base = entry
         let maybe_base = entry
             .take_key("base")
             .take_key("base")
             .expect("missing base key")
             .expect("missing base key")
@@ -45,12 +41,6 @@ fn urltestdata() {
         let input = entry.take_string("input");
         let input = entry.take_string("input");
         let failure = entry.take_key("failure").is_some();
         let failure = entry.take_key("failure").is_some();
 
 
-        {
-            if idna_skip_inputs.contains(&input.as_str()) {
-                continue;
-            }
-        }
-
         let res = if let Some(base) = maybe_base {
         let res = if let Some(base) = maybe_base {
             let base = match Url::parse(&base) {
             let base = match Url::parse(&base) {
                 Ok(base) => base,
                 Ok(base) => base,

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 668 - 160
url/tests/urltestdata.json


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov