gecko-dev/testing/web-platform/tests/url/urlencoded-parser.any.js
Mike Pennisi e9406a9a3c Bug 1468626 [wpt PR 11492] - Reformat URL tests, a=testonly
Automatic update from web-platform-testsGeneralize test

--
updated urlencoded-parser to use .any.js

--
issue 11277: convert url html test to any.js

--
Convert URL tests to .any.js format

- Convert url/urlsearchparams-append.html to .any.js
- Convert url/urlsearchparams-constructor.html to .any.js
- Convert url/urlsearchparams-foreach.html to .any.js
- Convert url/urlsearchparams-set.html to .any.js
- Convert url/urlsearchparams-getall.html to .any.js

--
Separate url-searchparams.any.js from url/url-constructor.html

--
converted additional urlsearchparams tests to use any.js

--
Generalize test.

--
Generalized Test

--
Relocate specification reference

--

wpt-commits: a1c591bbb2c67f708609608d82caf5e9970431f0, 5efc5e92401e8edc5b1cfbdc8679c9817af30413, 1f3019b4ae77f4b98de5d3affc162d0889f645d0, c6dd3dce89c8d1475b1354a03447750c14cd8804, 87dc680b64f89ec6e91fb8763d7b2da9677110c4, a734002040383222111fce80e50e7dc013a5812d, 39c743e4f7877abf16db6ace465089f6c61b2b60, 693caf30f6cf9f8bffbac2f06fbb538989663ab8, e6422d28a641dcb82a419c1f63efb975588960cf
wpt-pr: 11492
2018-08-08 12:09:38 +00:00

63 lines
2.6 KiB
JavaScript

[
{ "input": "test", "output": [["test", ""]] },
{ "input": "\uFEFFtest=\uFEFF", "output": [["\uFEFFtest", "\uFEFF"]] },
{ "input": "%EF%BB%BFtest=%EF%BB%BF", "output": [["\uFEFFtest", "\uFEFF"]] },
{ "input": "%FE%FF", "output": [["\uFFFD\uFFFD", ""]] },
{ "input": "%FF%FE", "output": [["\uFFFD\uFFFD", ""]] },
{ "input": "†&†=x", "output": [["†", ""], ["†", "x"]] },
{ "input": "%C2", "output": [["\uFFFD", ""]] },
{ "input": "%C2x", "output": [["\uFFFDx", ""]] },
{ "input": "_charset_=windows-1252&test=%C2x", "output": [["_charset_", "windows-1252"], ["test", "\uFFFDx"]] },
{ "input": '', "output": [] },
{ "input": 'a', "output": [['a', '']] },
{ "input": 'a=b', "output": [['a', 'b']] },
{ "input": 'a=', "output": [['a', '']] },
{ "input": '=b', "output": [['', 'b']] },
{ "input": '&', "output": [] },
{ "input": '&a', "output": [['a', '']] },
{ "input": 'a&', "output": [['a', '']] },
{ "input": 'a&a', "output": [['a', ''], ['a', '']] },
{ "input": 'a&b&c', "output": [['a', ''], ['b', ''], ['c', '']] },
{ "input": 'a=b&c=d', "output": [['a', 'b'], ['c', 'd']] },
{ "input": 'a=b&c=d&', "output": [['a', 'b'], ['c', 'd']] },
{ "input": '&&&a=b&&&&c=d&', "output": [['a', 'b'], ['c', 'd']] },
{ "input": 'a=a&a=b&a=c', "output": [['a', 'a'], ['a', 'b'], ['a', 'c']] },
{ "input": 'a==a', "output": [['a', '=a']] },
{ "input": 'a=a+b+c+d', "output": [['a', 'a b c d']] },
{ "input": '%=a', "output": [['%', 'a']] },
{ "input": '%a=a', "output": [['%a', 'a']] },
{ "input": '%a_=a', "output": [['%a_', 'a']] },
{ "input": '%61=a', "output": [['a', 'a']] },
{ "input": '%61+%4d%4D=', "output": [['a MM', '']] }
].forEach((val) => {
test(() => {
let sp = new URLSearchParams(val.input),
i = 0
for (let item of sp) {
assert_array_equals(item, val.output[i])
i++
}
}, "URLSearchParams constructed with: " + val.input)
promise_test(() => {
let init = new Request("about:blank", { body: val.input, method: "LADIDA", headers: {"Content-Type": "application/x-www-form-urlencoded;charset=windows-1252"} }).formData()
return init.then((fd) => {
let i = 0
for (let item of fd) {
assert_array_equals(item, val.output[i])
i++
}
})
}, "request.formData() with input: " + val.input)
promise_test(() => {
let init = new Response(val.input, { headers: {"Content-Type": "application/x-www-form-urlencoded;charset=shift_jis"} }).formData()
return init.then((fd) => {
let i = 0
for (let item of fd) {
assert_array_equals(item, val.output[i])
i++
}
})
}, "response.formData() with input: " + val.input)
});