-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #37467 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Richard Lau <[email protected]>
- Loading branch information
1 parent
c09bd77
commit a44daff
Showing
26 changed files
with
1,575 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
934 changes: 934 additions & 0 deletions
934
test/fixtures/wpt/common/third_party/reftest-analyzer.xhtml
Large diffs are not rendered by default.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
test/fixtures/wpt/encoding/legacy-mb-schinese/gb18030/gb18030-decoder.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// META: script=./resources/ranges.js | ||
|
||
const decode = (input, output, desc) => { | ||
test(function () { | ||
for (const encoding of ["gb18030", "gbk"]) { | ||
assert_equals( | ||
new TextDecoder(encoding).decode(new Uint8Array(input)), | ||
output, | ||
); | ||
} | ||
}, "gb18030 decoder: " + desc); | ||
}; | ||
|
||
decode([115], "s", "ASCII"); | ||
decode([0x80], "\u20AC", "euro"); | ||
decode([0xFF], "\uFFFD", "initial byte out of accepted ranges"); | ||
decode([0x81], "\uFFFD", "end of queue, gb18030 first not 0"); | ||
decode([0x81, 0x28], "\ufffd(", "two bytes 0x81 0x28"); | ||
decode([0x81, 0x40], "\u4E02", "two bytes 0x81 0x40"); | ||
decode([0x81, 0x7E], "\u4E8A", "two bytes 0x81 0x7e"); | ||
decode([0x81, 0x7F], "\ufffd\u007f", "two bytes 0x81 0x7f"); | ||
decode([0x81, 0x80], "\u4E90", "two bytes 0x81 0x80"); | ||
decode([0x81, 0xFE], "\u4FA2", "two bytes 0x81 0xFE"); | ||
decode([0x81, 0xFF], "\ufffd", "two bytes 0x81 0xFF"); | ||
decode([0xFE, 0x40], "\uFA0C", "two bytes 0xFE 0x40"); | ||
decode([0xFE, 0xFE], "\uE4C5", "two bytes 0xFE 0xFE"); | ||
decode([0xFE, 0xFF], "\ufffd", "two bytes 0xFE 0xFF"); | ||
decode([0x81, 0x30], "\ufffd", "two bytes 0x81 0x30"); | ||
decode([0x81, 0x30, 0xFE], "\ufffd", "three bytes 0x81 0x30 0xFE"); | ||
decode([0x81, 0x30, 0xFF], "\ufffd0\ufffd", "three bytes 0x81 0x30 0xFF"); | ||
decode( | ||
[0x81, 0x30, 0xFE, 0x29], | ||
"\ufffd0\ufffd)", | ||
"four bytes 0x81 0x30 0xFE 0x29", | ||
); | ||
decode([0xFE, 0x39, 0xFE, 0x39], "\ufffd", "four bytes 0xFE 0x39 0xFE 0x39"); | ||
decode([0x81, 0x35, 0xF4, 0x36], "\u1E3E", "pointer 7458"); | ||
decode([0x81, 0x35, 0xF4, 0x37], "\ue7c7", "pointer 7457"); | ||
decode([0x81, 0x35, 0xF4, 0x38], "\u1E40", "pointer 7459"); | ||
decode([0x84, 0x31, 0xA4, 0x39], "\uffff", "pointer 39419"); | ||
decode([0x84, 0x31, 0xA5, 0x30], "\ufffd", "pointer 39420"); | ||
decode([0x8F, 0x39, 0xFE, 0x39], "\ufffd", "pointer 189999"); | ||
decode([0x90, 0x30, 0x81, 0x30], "\u{10000}", "pointer 189000"); | ||
decode([0xE3, 0x32, 0x9A, 0x35], "\u{10FFFF}", "pointer 1237575"); | ||
decode([0xE3, 0x32, 0x9A, 0x36], "\ufffd", "pointer 1237576"); | ||
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"); | ||
|
||
let i = 0; | ||
for (const range of ranges) { | ||
const pointer = range[0]; | ||
decode( | ||
[ | ||
Math.floor(pointer / 12600) + 0x81, | ||
Math.floor((pointer % 12600) / 1260) + 0x30, | ||
Math.floor((pointer % 1260) / 10) + 0x81, | ||
pointer % 10 + 0x30, | ||
], | ||
range[1], | ||
"range " + i++, | ||
); | ||
} |
28 changes: 28 additions & 0 deletions
28
test/fixtures/wpt/encoding/legacy-mb-schinese/gbk/gbk-decoder.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const gbkPointers = [ | ||
6432, 7533, 7536, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684, | ||
23766, 23770, 23771, 23772, 23773, 23774, 23776, 23777, 23778, 23779, 23780, 23781, 23782, 23784, 23785, 23786, | ||
23787, 23790, 23791, 23792, 23793, 23796, 23797, 23798, 23799, 23800, 23801, 23802, 23803, 23805, 23806, 23807, | ||
23808, 23809, 23810, 23811, 23813, 23814, 23815, 23816, 23817, 23818, 23819, 23820, 23821, 23822, 23823, 23824, | ||
23825, 23826, 23827, 23828, 23831, 23832, 23833, 23834, 23835, 23836, 23837, 23838, 23839, 23840, 23841, 23842, | ||
23843, 23844 | ||
]; | ||
const codePoints = [ | ||
0x20ac, 0x1e3f, 0x01f9, 0x303e, 0x2ff0, 0x2ff1, 0x2ff2, 0x2ff3, 0x2ff4, 0x2ff5, 0x2ff6, 0x2ff7, 0x2ff8, 0x2ff9, 0x2ffa, 0x2ffb, | ||
0x2e81, 0x2e84, 0x3473, 0x3447, 0x2e88, 0x2e8b, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e, 0x3918, 0x39cf, 0x39df, 0x3a73, | ||
0x39d0, 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0x2eaa, 0x4056, 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0x43b1, 0x43ac, 0x2ebb, | ||
0x43dd, 0x44d6, 0x4661, 0x464c, 0x4723, 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982, 0x4983, 0x4985, 0x4986, | ||
0x499f, 0x499b, 0x49b7, 0x49b6, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13, 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18, | ||
0x4d19, 0x4dae | ||
]; | ||
|
||
for (let i = 0; i < gbkPointers.length; i++) { | ||
const pointer = gbkPointers[i]; | ||
test(function() { | ||
const lead = pointer / 190 + 0x81; | ||
const trail = pointer % 190; | ||
const offset = trail < 0x3F ? 0x40 : 0x41; | ||
const encoded = [lead, trail + offset]; | ||
const decoded = new TextDecoder("GBK").decode(new Uint8Array(encoded)).charCodeAt(0); | ||
assert_equals(decoded, codePoints[i]); | ||
}, "gbk pointer: " + pointer) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// META: title=Encoding API: TextDecoder decode() optional arguments | ||
|
||
test(t => { | ||
const decoder = new TextDecoder(); | ||
|
||
// Just passing nothing. | ||
assert_equals( | ||
decoder.decode(undefined), '', | ||
'Undefined as first arg should decode to empty string'); | ||
|
||
// Flushing an incomplete sequence. | ||
decoder.decode(new Uint8Array([0xc9]), {stream: true}); | ||
assert_equals( | ||
decoder.decode(undefined), '\uFFFD', | ||
'Undefined as first arg should flush the stream'); | ||
|
||
}, 'TextDecoder decode() with explicit undefined'); | ||
|
||
test(t => { | ||
const decoder = new TextDecoder(); | ||
|
||
// Just passing nothing. | ||
assert_equals( | ||
decoder.decode(undefined, undefined), '', | ||
'Undefined as first arg should decode to empty string'); | ||
|
||
// Flushing an incomplete sequence. | ||
decoder.decode(new Uint8Array([0xc9]), {stream: true}); | ||
assert_equals( | ||
decoder.decode(undefined, undefined), '\uFFFD', | ||
'Undefined as first arg should flush the stream'); | ||
|
||
}, 'TextDecoder decode() with undefined and undefined'); | ||
|
||
test(t => { | ||
const decoder = new TextDecoder(); | ||
|
||
// Just passing nothing. | ||
assert_equals( | ||
decoder.decode(undefined, {}), '', | ||
'Undefined as first arg should decode to empty string'); | ||
|
||
// Flushing an incomplete sequence. | ||
decoder.decode(new Uint8Array([0xc9]), {stream: true}); | ||
assert_equals( | ||
decoder.decode(undefined, {}), '\uFFFD', | ||
'Undefined as first arg should flush the stream'); | ||
|
||
}, 'TextDecoder decode() with undefined and options'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/fixtures/wpt/html/webappapis/timers/negative-setinterval.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
setup({ single_test: true }); | ||
var i = 0; | ||
var interval; | ||
function next() { | ||
i++; | ||
if (i === 20) { | ||
clearInterval(interval); | ||
done(); | ||
} | ||
} | ||
setTimeout(assert_unreached, 1000); | ||
interval = setInterval(next, -100); |
3 changes: 3 additions & 0 deletions
3
test/fixtures/wpt/html/webappapis/timers/negative-settimeout.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setup({ single_test: true }); | ||
setTimeout(done, -100); | ||
setTimeout(assert_unreached, 10); |
8 changes: 8 additions & 0 deletions
8
test/fixtures/wpt/html/webappapis/timers/type-long-setinterval.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
setup({ single_test: true }); | ||
var interval; | ||
function next() { | ||
clearInterval(interval); | ||
done(); | ||
} | ||
interval = setInterval(next, Math.pow(2, 32)); | ||
setTimeout(assert_unreached, 100); |
3 changes: 3 additions & 0 deletions
3
test/fixtures/wpt/html/webappapis/timers/type-long-settimeout.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
setup({ single_test: true }); | ||
setTimeout(done, Math.pow(2, 32)); | ||
setTimeout(assert_unreached, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.