mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: update encoding web-platform tests
PR-URL: https://github.com/nodejs/node/pull/53477 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
2
test/fixtures/wpt/README.md
vendored
2
test/fixtures/wpt/README.md
vendored
@@ -15,7 +15,7 @@ Last update:
|
||||
- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
|
||||
- dom/abort: https://github.com/web-platform-tests/wpt/tree/d1f1ecbd52/dom/abort
|
||||
- dom/events: https://github.com/web-platform-tests/wpt/tree/ab8999891c/dom/events
|
||||
- encoding: https://github.com/web-platform-tests/wpt/tree/a58bbf6d8c/encoding
|
||||
- encoding: https://github.com/web-platform-tests/wpt/tree/5aa50dd415/encoding
|
||||
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
|
||||
- FileAPI: https://github.com/web-platform-tests/wpt/tree/cceaf3628d/FileAPI
|
||||
- hr-time: https://github.com/web-platform-tests/wpt/tree/34cafd797e/hr-time
|
||||
|
||||
1
test/fixtures/wpt/encoding/api-basics.any.js
vendored
1
test/fixtures/wpt/encoding/api-basics.any.js
vendored
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: Basics
|
||||
|
||||
test(function() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: Invalid UTF-16 surrogates with UTF-8 encoding
|
||||
|
||||
var badStrings = [
|
||||
|
||||
1
test/fixtures/wpt/encoding/encodeInto.any.js
vendored
1
test/fixtures/wpt/encoding/encodeInto.any.js
vendored
@@ -129,6 +129,7 @@
|
||||
"Uint8ClampedArray",
|
||||
"BigInt64Array",
|
||||
"BigUint64Array",
|
||||
"Float16Array",
|
||||
"Float32Array",
|
||||
"Float64Array"].forEach(type => {
|
||||
["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
//
|
||||
function decode(input, output, desc) {
|
||||
test(function() {
|
||||
var d = new TextDecoder("iso-2022-jp"),
|
||||
|
||||
@@ -47,6 +47,44 @@ decode([0x83, 0x36, 0xC8, 0x30], "\uE7C8", "legacy ICU special case 1");
|
||||
decode([0xA1, 0xAD], "\u2026", "legacy ICU special case 2");
|
||||
decode([0xA1, 0xAB], "\uFF5E", "legacy ICU special case 3");
|
||||
|
||||
// GB18030-2022
|
||||
decode([0xA6, 0xD9], "\uFE10", "GB18030-2022 1");
|
||||
decode([0xA6, 0xDA], "\uFE12", "GB18030-2022 2");
|
||||
decode([0xA6, 0xDB], "\uFE11", "GB18030-2022 3");
|
||||
decode([0xA6, 0xDC], "\uFE13", "GB18030-2022 4");
|
||||
decode([0xA6, 0xDD], "\uFE14", "GB18030-2022 5");
|
||||
decode([0xA6, 0xDE], "\uFE15", "GB18030-2022 6");
|
||||
decode([0xA6, 0xDF], "\uFE16", "GB18030-2022 7");
|
||||
decode([0xA6, 0xEC], "\uFE17", "GB18030-2022 8");
|
||||
decode([0xA6, 0xED], "\uFE18", "GB18030-2022 9");
|
||||
decode([0xA6, 0xF3], "\uFE19", "GB18030-2022 10");
|
||||
decode([0xFE, 0x59], "\u9FB4", "GB18030-2022 11");
|
||||
decode([0xFE, 0x61], "\u9FB5", "GB18030-2022 12");
|
||||
decode([0xFE, 0x66], "\u9FB6", "GB18030-2022 13");
|
||||
decode([0xFE, 0x67], "\u9FB7", "GB18030-2022 14");
|
||||
decode([0xFE, 0x6D], "\u9FB8", "GB18030-2022 15");
|
||||
decode([0xFE, 0x7E], "\u9FB9", "GB18030-2022 16");
|
||||
decode([0xFE, 0x90], "\u9FBA", "GB18030-2022 17");
|
||||
decode([0xFE, 0xA0], "\u9FBB", "GB18030-2022 18");
|
||||
decode([0x82, 0x35, 0x90, 0x37], "\uE81E", "GB18030-2022 19");
|
||||
decode([0x82, 0x35, 0x90, 0x38], "\uE826", "GB18030-2022 20");
|
||||
decode([0x82, 0x35, 0x90, 0x39], "\uE82B", "GB18030-2022 21");
|
||||
decode([0x82, 0x35, 0x91, 0x30], "\uE82C", "GB18030-2022 22");
|
||||
decode([0x82, 0x35, 0x91, 0x31], "\uE832", "GB18030-2022 23");
|
||||
decode([0x82, 0x35, 0x91, 0x32], "\uE843", "GB18030-2022 24");
|
||||
decode([0x82, 0x35, 0x91, 0x33], "\uE854", "GB18030-2022 25");
|
||||
decode([0x82, 0x35, 0x91, 0x34], "\uE864", "GB18030-2022 26");
|
||||
decode([0x84, 0x31, 0x82, 0x36], "\uE78D", "GB18030-2022 27");
|
||||
decode([0x84, 0x31, 0x82, 0x37], "\uE78F", "GB18030-2022 28");
|
||||
decode([0x84, 0x31, 0x82, 0x38], "\uE78E", "GB18030-2022 29");
|
||||
decode([0x84, 0x31, 0x82, 0x39], "\uE790", "GB18030-2022 30");
|
||||
decode([0x84, 0x31, 0x83, 0x30], "\uE791", "GB18030-2022 31");
|
||||
decode([0x84, 0x31, 0x83, 0x31], "\uE792", "GB18030-2022 32");
|
||||
decode([0x84, 0x31, 0x83, 0x32], "\uE793", "GB18030-2022 33");
|
||||
decode([0x84, 0x31, 0x83, 0x33], "\uE794", "GB18030-2022 34");
|
||||
decode([0x84, 0x31, 0x83, 0x34], "\uE795", "GB18030-2022 35");
|
||||
decode([0x84, 0x31, 0x83, 0x35], "\uE796", "GB18030-2022 36");
|
||||
|
||||
let i = 0;
|
||||
for (const range of ranges) {
|
||||
const pointer = range[0];
|
||||
|
||||
@@ -24,6 +24,44 @@
|
||||
encode("\u2026", "%A1%AD", "legacy ICU special case 2");
|
||||
encode("\uFF5E", "%A1%AB", "legacy ICU special case 3");
|
||||
|
||||
// GB18030-2022
|
||||
encode("\uFE10", "%A6%D9", "GB18030-2022 1");
|
||||
encode("\uFE12", "%A6%DA", "GB18030-2022 2");
|
||||
encode("\uFE11", "%A6%DB", "GB18030-2022 3");
|
||||
encode("\uFE13", "%A6%DC", "GB18030-2022 4");
|
||||
encode("\uFE14", "%A6%DD", "GB18030-2022 5");
|
||||
encode("\uFE15", "%A6%DE", "GB18030-2022 6");
|
||||
encode("\uFE16", "%A6%DF", "GB18030-2022 7");
|
||||
encode("\uFE17", "%A6%EC", "GB18030-2022 8");
|
||||
encode("\uFE18", "%A6%ED", "GB18030-2022 9");
|
||||
encode("\uFE19", "%A6%F3", "GB18030-2022 10");
|
||||
encode("\u9FB4", "%FEY", "GB18030-2022 11");
|
||||
encode("\u9FB5", "%FEa", "GB18030-2022 12");
|
||||
encode("\u9FB6", "%FEf", "GB18030-2022 13");
|
||||
encode("\u9FB7", "%FEg", "GB18030-2022 14");
|
||||
encode("\u9FB8", "%FEm", "GB18030-2022 15");
|
||||
encode("\u9FB9", "%FE~", "GB18030-2022 16");
|
||||
encode("\u9FBA", "%FE%90", "GB18030-2022 17");
|
||||
encode("\u9FBB", "%FE%A0", "GB18030-2022 18");
|
||||
encode("\uE78D", "%841%826", "GB18030-2022 19");
|
||||
encode("\uE78E", "%841%828", "GB18030-2022 20");
|
||||
encode("\uE78F", "%841%827", "GB18030-2022 21");
|
||||
encode("\uE790", "%841%829", "GB18030-2022 22");
|
||||
encode("\uE791", "%841%830", "GB18030-2022 23");
|
||||
encode("\uE792", "%841%831", "GB18030-2022 24");
|
||||
encode("\uE793", "%841%832", "GB18030-2022 25");
|
||||
encode("\uE794", "%841%833", "GB18030-2022 26");
|
||||
encode("\uE795", "%841%834", "GB18030-2022 27");
|
||||
encode("\uE796", "%841%835", "GB18030-2022 28");
|
||||
encode("\uE81E", "%825%907", "GB18030-2022 29");
|
||||
encode("\uE826", "%825%908", "GB18030-2022 30");
|
||||
encode("\uE82B", "%825%909", "GB18030-2022 31");
|
||||
encode("\uE82C", "%825%910", "GB18030-2022 32");
|
||||
encode("\uE832", "%825%911", "GB18030-2022 33");
|
||||
encode("\uE843", "%825%912", "GB18030-2022 34");
|
||||
encode("\uE854", "%825%913", "GB18030-2022 35");
|
||||
encode("\uE864", "%825%914", "GB18030-2022 36");
|
||||
|
||||
const upperCaseNibble = x => {
|
||||
return Math.floor(x).toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -6,9 +6,7 @@
|
||||
test(() => {
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
const buffer = new SharedArrayBuffer(4);
|
||||
assert_throws_js(TypeError, () => {
|
||||
decoder.decode(new Uint8Array(buffer));
|
||||
}, 'constructing TextDecoder with SharedArrayBuffer view should throw');
|
||||
assert_equals(decoder.decode(new Uint8Array(buffer)), "\u0000\u0000\u0000\u0000");
|
||||
}, 'decoding SharedArrayBuffer');
|
||||
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// META: global=window,worker
|
||||
// META: global=window,worker,shadowrealm
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// META: global=window,worker
|
||||
// META: global=window,worker,shadowrealm
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// META: global=window,worker
|
||||
// META: global=window,worker,shadowrealm
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// META: global=window,worker
|
||||
// META: global=window,worker,shadowrealm
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// META: global=window,worker
|
||||
// META: global=window,worker,shadowrealm
|
||||
|
||||
// This just tests that the "readable" and "writable" properties pass the brand
|
||||
// checks. All other relevant attributes are covered by the IDL tests.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: TextDecoder decode() optional arguments
|
||||
|
||||
test(t => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: Byte-order marks
|
||||
|
||||
var testCases = [
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: End-of-file
|
||||
|
||||
test(function() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: Fatal flag
|
||||
|
||||
var bad = [
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: TextDecoder ignoreBOM option
|
||||
|
||||
var cases = [
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: UTF-16 surrogate handling
|
||||
|
||||
var bad = [
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
// META: title=Encoding API: USVString surrogate handling when encoding
|
||||
|
||||
var bad = [
|
||||
|
||||
2
test/fixtures/wpt/versions.json
vendored
2
test/fixtures/wpt/versions.json
vendored
@@ -20,7 +20,7 @@
|
||||
"path": "dom/events"
|
||||
},
|
||||
"encoding": {
|
||||
"commit": "a58bbf6d8c0db1f1fd5352e846acb0754ee55567",
|
||||
"commit": "5aa50dd4151b5bc1d04d5505366c6e27df30af5b",
|
||||
"path": "encoding"
|
||||
},
|
||||
"fetch/data-urls/resources": {
|
||||
|
||||
@@ -77,6 +77,12 @@
|
||||
"requires": ["full-icu"]
|
||||
},
|
||||
"encodeInto.any.js": {
|
||||
"fail": {
|
||||
"expected": [
|
||||
"Invalid encodeInto() destination: Float16Array, backed by: ArrayBuffer",
|
||||
"Invalid encodeInto() destination: Float16Array, backed by: SharedArrayBuffer"
|
||||
]
|
||||
},
|
||||
"requires": ["small-icu"]
|
||||
},
|
||||
"textdecoder-copy.any.js": {
|
||||
|
||||
Reference in New Issue
Block a user