Skip to content

Commit

Permalink
Move some tests from toascii.json to urltestdata.json and setters_tes…
Browse files Browse the repository at this point in the history
…ts.json

These were introduced in e9a1061. However, these are not tests of the Unicode ToASCII algorithm. They are tests of the extra step introduced in whatwg/url@cceb435 to the URL Standard.

Keep toascii.json focused on testing the ToASCII algorithm, so that software which implements it can use that file.
  • Loading branch information
domenic committed Mar 7, 2023
1 parent 5029df7 commit 5d5a731
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 17 deletions.
72 changes: 72 additions & 0 deletions url/resources/setters_tests.json
Expand Up @@ -1061,6 +1061,42 @@
"host": "",
"hostname": ""
}
},
{
"href": "https://example.com/",
"new_value": "a%C2%ADb",
"expected": {
"href": "https://ab/",
"host": "ab",
"hostname": "ab"
}
},
{
"href": "https://example.com/",
"new_value": "\u00AD",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
},
{
"href": "https://example.com/",
"new_value": "%C2%AD",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
},
{
"href": "https://example.com/",
"new_value": "xn--",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
}
],
"hostname": [
Expand Down Expand Up @@ -1436,6 +1472,42 @@
"host": "",
"hostname": ""
}
},
{
"href": "https://example.com/",
"new_value": "a%C2%ADb",
"expected": {
"href": "https://ab/",
"host": "ab",
"hostname": "ab"
}
},
{
"href": "https://example.com/",
"new_value": "\u00AD",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
},
{
"href": "https://example.com/",
"new_value": "%C2%AD",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
},
{
"href": "https://example.com/",
"new_value": "xn--",
"expected": {
"href": "https://example.com/",
"host": "example.com",
"hostname": "example.com"
}
}
],
"port": [
Expand Down
17 changes: 0 additions & 17 deletions url/resources/toascii.json
Expand Up @@ -160,23 +160,6 @@
"input": "a\u00ADb",
"output": "ab"
},
{
"input": "a%C2%ADb",
"output": "ab"
},
{
"comment": "Empty host after domain to ASCII",
"input": "\u00AD",
"output": null
},
{
"input": "%C2%AD",
"output": null
},
{
"input": "xn--",
"output": null
},
{
"comment": "Interesting UseSTD3ASCIIRules=false cases",
"input": "",
Expand Down
31 changes: 31 additions & 0 deletions url/resources/urltestdata.json
Expand Up @@ -8892,5 +8892,36 @@
"protocol": "https:",
"search": "",
"username": ""
},
{
"input": "https://a%C2%ADb/",
"base": "about:blank",
"hash": "",
"host": "ab",
"hostname": "ab",
"href": "https://ab/",
"origin": "https://ab",
"password": "",
"pathname": "/",
"port": "",
"protocol": "https:",
"search": "",
"username": ""
},
{
"comment": "Empty host after domain to ASCII",
"input": "https://\u00AD/",
"base": "about:blank",
"failure": true
},
{
"input": "https://%C2%AD/",
"base": "about:blank",
"failure": true
},
{
"input": "https://xn--/",
"base": "about:blank",
"failure": true
}
]

0 comments on commit 5d5a731

Please sign in to comment.