mirror of
https://github.com/servo/servo.git
synced 2025-09-17 02:18:23 +01:00
Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d
This commit is contained in:
parent
c45192614c
commit
775b784f79
2144 changed files with 58115 additions and 29658 deletions
|
@ -1,3 +1,4 @@
|
|||
spec: https://encoding.spec.whatwg.org/
|
||||
suggested_reviewers:
|
||||
- inexorabletash
|
||||
- annevk
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Basics</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Basics
|
||||
|
||||
test(function() {
|
||||
assert_equals((new TextEncoder).encoding, 'utf-8', 'default encoding is utf-8');
|
||||
|
@ -54,5 +50,3 @@ testDecodeSample(
|
|||
sample,
|
||||
[0x7A, 0x00, 0xA2, 0x00, 0x34, 0x6C, 0x34, 0xD8, 0x1E, 0xDD, 0xFF, 0xF8, 0xFF, 0xDB, 0xFD, 0xDF, 0xFE, 0xFF]
|
||||
);
|
||||
|
||||
</script>
|
|
@ -1,10 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: invalid label</title>
|
||||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: invalid label
|
||||
// META: timeout=long
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
var tests = ["invalid-invalidLabel"];
|
||||
setup(function() {
|
||||
encodings_table.forEach(function(section) {
|
||||
|
@ -25,4 +22,3 @@ tests.forEach(function(input) {
|
|||
assert_throws(new RangeError(), function() { new TextDecoder(input); });
|
||||
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
|
||||
});
|
||||
</script>
|
|
@ -1,9 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: replacement encoding</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: replacement encoding
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
encodings_table.forEach(function(section) {
|
||||
section.encodings.filter(function(encoding) {
|
||||
|
@ -17,4 +13,3 @@ encodings_table.forEach(function(section) {
|
|||
});
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Invalid UTF-16 surrogates with UTF-8 encoding</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Invalid UTF-16 surrogates with UTF-8 encoding
|
||||
|
||||
var badStrings = [
|
||||
{
|
||||
|
@ -50,5 +46,3 @@ badStrings.forEach(function(t) {
|
|||
assert_equals(new TextDecoder('utf-8').decode(encoded), t.decoded);
|
||||
}, 'Invalid surrogates encoded into UTF-8: ' + t.name);
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,50 @@
|
|||
function decode(input, output, desc) {
|
||||
test(function() {
|
||||
var d = new TextDecoder("iso-2022-jp"),
|
||||
buffer = new ArrayBuffer(input.length),
|
||||
view = new Int8Array(buffer)
|
||||
for(var i = 0, l = input.length; i < l; i++) {
|
||||
view[i] = input[i]
|
||||
}
|
||||
assert_equals(d.decode(view), output)
|
||||
}, "iso-2022-jp decoder: " + desc)
|
||||
}
|
||||
decode([0x1b, 0x24], "<22>$", "Error ESC")
|
||||
decode([0x1b, 0x24, 0x50], "<22>$P", "Error ESC, character")
|
||||
decode([0x1b, 0x28, 0x42, 0x50], "P", "ASCII ESC, character")
|
||||
decode([0x1b, 0x28, 0x42, 0x1b, 0x28, 0x42, 0x50], "<22>P", "Double ASCII ESC, character")
|
||||
decode([0x50, 0x1b, 0x28, 0x42, 0x50], "PP", "character, ASCII ESC, character")
|
||||
decode([0x5C, 0x5D, 0x7E], "\\]~", "characters")
|
||||
decode([0x0D, 0x0E, 0x0F, 0x10], "\x0D<30><44>\x10", "SO / SI")
|
||||
|
||||
decode([0x1b, 0x28, 0x4A, 0x5C, 0x5D, 0x7E], "¥]‾", "Roman ESC, characters")
|
||||
decode([0x1b, 0x28, 0x4A, 0x0D, 0x0E, 0x0F, 0x10], "\x0D<30><44>\x10", "Roman ESC, SO / SI")
|
||||
decode([0x1b, 0x28, 0x4A, 0x1b, 0x1b, 0x28, 0x49, 0x50], "<22>ミ", "Roman ESC, error ESC, Katakana ESC")
|
||||
|
||||
decode([0x1b, 0x28, 0x49, 0x50], "ミ", "Katakana ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Katakana ESC, multibyte ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x50], "<22>ミ", "Katakana ESC, error ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x50], "<22>、ミ", "Katakana ESC, error ESC #2, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x50, 0x1b, 0x28, 0x49, 0x50], "ミミ", "Katakana ESC, character, Katakana ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x0D, 0x0E, 0x0F, 0x10], "<22><><EFBFBD><EFBFBD>", "Katakana ESC, SO / SI")
|
||||
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x50], "佩", "Multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x42, 0x50, 0x50], "佩", "Multibyte ESC #2, character")
|
||||
decode([0x1b, 0x24, 0x42, 0x1b, 0x50, 0x50], "<22>佩", "Multibyte ESC, error ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40], "<22>", "Double multibyte ESC")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Double multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x42, 0x50, 0x50], "<22>佩", "Double multibyte ESC #2, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x50, 0x50], "<22>ば<EFBFBD>", "Multibyte ESC, error ESC #2, character")
|
||||
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Multibyte ESC, single byte, multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x20, 0x50], "<22><>", "Multibyte ESC, lead error byte")
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x20], "<22>", "Multibyte ESC, trail error byte")
|
||||
|
||||
decode([0x50, 0x1b], "P<>", "character, error ESC")
|
||||
decode([0x50, 0x1b, 0x24], "P<>$", "character, error ESC #2")
|
||||
decode([0x50, 0x1b, 0x50], "P<>P", "character, error ESC #3")
|
||||
decode([0x50, 0x1b, 0x28, 0x42], "P", "character, ASCII ESC")
|
||||
decode([0x50, 0x1b, 0x28, 0x4A], "P", "character, Roman ESC")
|
||||
decode([0x50, 0x1b, 0x28, 0x49], "P", "character, Katakana ESC")
|
||||
decode([0x50, 0x1b, 0x24, 0x40], "P", "character, Multibyte ESC")
|
||||
decode([0x50, 0x1b, 0x24, 0x42], "P", "character, Multibyte ESC #2")
|
|
@ -1,57 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function decode(input, output, desc) {
|
||||
test(function() {
|
||||
var d = new TextDecoder("iso-2022-jp"),
|
||||
buffer = new ArrayBuffer(input.length),
|
||||
view = new Int8Array(buffer)
|
||||
for(var i = 0, l = input.length; i < l; i++) {
|
||||
view[i] = input[i]
|
||||
}
|
||||
assert_equals(d.decode(view), output)
|
||||
}, "iso-2022-jp decoder: " + desc)
|
||||
}
|
||||
decode([0x1b, 0x24], "<22>$", "Error ESC")
|
||||
decode([0x1b, 0x24, 0x50], "<22>$P", "Error ESC, character")
|
||||
decode([0x1b, 0x28, 0x42, 0x50], "P", "ASCII ESC, character")
|
||||
decode([0x1b, 0x28, 0x42, 0x1b, 0x28, 0x42, 0x50], "<22>P", "Double ASCII ESC, character")
|
||||
decode([0x50, 0x1b, 0x28, 0x42, 0x50], "PP", "character, ASCII ESC, character")
|
||||
decode([0x5C, 0x5D, 0x7E], "\\]~", "characters")
|
||||
decode([0x0D, 0x0E, 0x0F, 0x10], "\x0D<30><44>\x10", "SO / SI")
|
||||
|
||||
decode([0x1b, 0x28, 0x4A, 0x5C, 0x5D, 0x7E], "¥]‾", "Roman ESC, characters")
|
||||
decode([0x1b, 0x28, 0x4A, 0x0D, 0x0E, 0x0F, 0x10], "\x0D<30><44>\x10", "Roman ESC, SO / SI")
|
||||
decode([0x1b, 0x28, 0x4A, 0x1b, 0x1b, 0x28, 0x49, 0x50], "<22>ミ", "Roman ESC, error ESC, Katakana ESC")
|
||||
|
||||
decode([0x1b, 0x28, 0x49, 0x50], "ミ", "Katakana ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Katakana ESC, multibyte ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x50], "<22>ミ", "Katakana ESC, error ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x50], "<22>、ミ", "Katakana ESC, error ESC #2, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x50, 0x1b, 0x28, 0x49, 0x50], "ミミ", "Katakana ESC, character, Katakana ESC, character")
|
||||
decode([0x1b, 0x28, 0x49, 0x0D, 0x0E, 0x0F, 0x10], "<22><><EFBFBD><EFBFBD>", "Katakana ESC, SO / SI")
|
||||
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x50], "佩", "Multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x42, 0x50, 0x50], "佩", "Multibyte ESC #2, character")
|
||||
decode([0x1b, 0x24, 0x42, 0x1b, 0x50, 0x50], "<22>佩", "Multibyte ESC, error ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40], "<22>", "Double multibyte ESC")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Double multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x42, 0x50, 0x50], "<22>佩", "Double multibyte ESC #2, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x50, 0x50], "<22>ば<EFBFBD>", "Multibyte ESC, error ESC #2, character")
|
||||
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x1b, 0x24, 0x40, 0x50, 0x50], "<22>佩", "Multibyte ESC, single byte, multibyte ESC, character")
|
||||
decode([0x1b, 0x24, 0x40, 0x20, 0x50], "<22><>", "Multibyte ESC, lead error byte")
|
||||
decode([0x1b, 0x24, 0x40, 0x50, 0x20], "<22>", "Multibyte ESC, trail error byte")
|
||||
|
||||
decode([0x50, 0x1b], "P<>", "character, error ESC")
|
||||
decode([0x50, 0x1b, 0x24], "P<>$", "character, error ESC #2")
|
||||
decode([0x50, 0x1b, 0x50], "P<>P", "character, error ESC #3")
|
||||
decode([0x50, 0x1b, 0x28, 0x42], "P", "character, ASCII ESC")
|
||||
decode([0x50, 0x1b, 0x28, 0x4A], "P", "character, Roman ESC")
|
||||
decode([0x50, 0x1b, 0x28, 0x49], "P", "character, Katakana ESC")
|
||||
decode([0x50, 0x1b, 0x24, 0x40], "P", "character, Multibyte ESC")
|
||||
decode([0x50, 0x1b, 0x24, 0x42], "P", "character, Multibyte ESC #2")
|
||||
</script>
|
|
@ -6,6 +6,7 @@
|
|||
<meta name="timeout" content="long">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/subset-tests.js"></script>
|
||||
<link rel="author" title="Richard Ishida" href="mailto:ishida@w3.org">
|
||||
<link rel="help" href="https://encoding.spec.whatwg.org/#names-and-labels">
|
||||
<meta name="assert" content="The browser produces the same decoding behavior for a document labeled 'ksc_5601' as for a document labeled 'euc-kr'.">
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: replacement encoding</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script src="resources/decoding-helpers.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: replacement encoding
|
||||
// META: script=resources/encodings.js
|
||||
// META: script=resources/decoding-helpers.js
|
||||
|
||||
const replacement_labels = [];
|
||||
encodings_table.forEach(section => {
|
||||
|
@ -27,4 +23,3 @@ replacement_labels.forEach(label => {
|
|||
'',
|
||||
'', `${label} - empty input decodes to empty output.`);
|
||||
});
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Byte-order marks</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Byte-order marks
|
||||
|
||||
var testCases = [
|
||||
{
|
||||
|
@ -44,5 +40,3 @@ testCases.forEach(function(t) {
|
|||
|
||||
}, 'Byte-order marks: ' + t.encoding);
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Fatal flag for single byte encodings</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Fatal flag for single byte encodings
|
||||
|
||||
var singleByteEncodings = [
|
||||
{encoding: 'IBM866', bad: []},
|
||||
|
@ -51,5 +47,3 @@ singleByteEncodings.forEach(function(t) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: End-of-file</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: End-of-file
|
||||
|
||||
test(function() {
|
||||
[
|
||||
|
@ -46,5 +42,3 @@ test(function() {
|
|||
assert_equals(decoder.decode(even), '\u0000');
|
||||
|
||||
}, 'Fatal flag, streaming cases');
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Fatal flag</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Fatal flag
|
||||
|
||||
var bad = [
|
||||
{ encoding: 'utf-8', input: [0xFF], name: 'invalid code' },
|
||||
|
@ -68,5 +64,3 @@ test(function() {
|
|||
assert_true(new TextDecoder('utf-8', {fatal: true}).fatal, 'The fatal attribute can be set using an option.');
|
||||
|
||||
}, 'The fatal attribute of TextDecoder');
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: TextDecoder ignoreBOM option</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: TextDecoder ignoreBOM option
|
||||
|
||||
var cases = [
|
||||
{encoding: 'utf-8', bytes: [0xEF, 0xBB, 0xBF, 0x61, 0x62, 0x63]},
|
||||
|
@ -41,5 +37,3 @@ test(function() {
|
|||
assert_true(new TextDecoder('utf-8', {ignoreBOM: true}).ignoreBOM, 'The ignoreBOM attribute can be set using an option.');
|
||||
|
||||
}, 'The ignoreBOM attribute of TextDecoder');
|
||||
|
||||
</script>
|
|
@ -1,9 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Encoding labels</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Encoding labels
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
var whitespace = [' ', '\t', '\n', '\f', '\r'];
|
||||
encodings_table.forEach(function(section) {
|
||||
section.encodings.filter(function(encoding) {
|
||||
|
@ -33,4 +30,3 @@ encodings_table.forEach(function(section) {
|
|||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,9 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Streaming decode</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Streaming decode
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
var string = '\x00123ABCabc\x80\xFF\u0100\u1000\uFFFD\uD800\uDC00\uDBFF\uDFFF';
|
||||
var octets = {
|
||||
|
@ -38,5 +34,3 @@ Object.keys(octets).forEach(function(encoding) {
|
|||
}, 'Streaming decode: ' + encoding + ', ' + len + ' byte window');
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: UTF-16 surrogate handling</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: UTF-16 surrogate handling
|
||||
|
||||
var bad = [
|
||||
{
|
||||
|
@ -47,5 +43,3 @@ bad.forEach(function(t) {
|
|||
});
|
||||
}, t.encoding + ' - ' + t.name + ' (fatal flag set)');
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,9 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: Legacy encodings</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: Legacy encodings
|
||||
// META: script=resources/encodings.js
|
||||
|
||||
encodings_table.forEach(function(section) {
|
||||
section.encodings.forEach(function(encoding) {
|
||||
|
@ -18,5 +14,3 @@ encodings_table.forEach(function(section) {
|
|||
}, 'Encoding argument not considered for encode: ' + encoding.name);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
|
@ -1,8 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: USVString surrogate handling when encoding</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: USVString surrogate handling when encoding
|
||||
|
||||
var bad = [
|
||||
{
|
||||
|
@ -48,5 +44,3 @@ bad.forEach(function(t) {
|
|||
test(function() {
|
||||
assert_equals(new TextEncoder().encode().length, 0, 'Should default to empty string');
|
||||
}, 'USVString default');
|
||||
|
||||
</script>
|
|
@ -1,9 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Encoding API: unsupported encodings</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/decoding-helpers.js"></script>
|
||||
<script>
|
||||
// META: title=Encoding API: unsupported encodings
|
||||
// META: script=resources/decoding-helpers.js
|
||||
|
||||
// Attempting to decode '<' as UTF-7 (+AD4) ends up as '+AD4'.
|
||||
['UTF-7', 'utf-7'].forEach(label => {
|
||||
|
@ -34,4 +30,3 @@
|
|||
'U+0000/U+0000/U+00FE/U+00FF/U+0000/U+0000/U+0000/U+0041/U+0000/U+0000/U+0000/U+0042',
|
||||
`${label} with BOM should decode as windows-1252`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue