mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
Update web-platform-tests to revision fef3eb9bbb033d1d7150f4c70ecc1a5f59bcf115
This commit is contained in:
parent
7ee605db11
commit
14e48d959c
15 changed files with 302 additions and 131 deletions
|
@ -2,13 +2,32 @@
|
|||
<title>Encoding API: invalid label</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/encodings.js"></script>
|
||||
<script>
|
||||
var tests = ["invalid-invalidLabel"];
|
||||
setup(function() {
|
||||
encodings_table.forEach(function(section) {
|
||||
section.encodings.filter(function(encoding) {
|
||||
return encoding.name !== 'replacement';
|
||||
}).forEach(function(encoding) {
|
||||
encoding.labels.forEach(function(label) {
|
||||
["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
|
||||
tests.push(ws + label);
|
||||
tests.push(label + ws);
|
||||
tests.push(ws + label + ws);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var invalidLabel = "invalid-invalidLabel"
|
||||
|
||||
test(function() {
|
||||
assert_throws(new RangeError(), function() { new TextEncoder(invalidLabel); });
|
||||
assert_throws(new RangeError(), function() { new TextDecoder(invalidLabel); });
|
||||
}, 'Invalid label "' + invalidLabel + '" should be rejected by API.');
|
||||
tests.forEach(function(input) {
|
||||
test(function() {
|
||||
assert_throws(new RangeError(), function() { new TextEncoder(input); });
|
||||
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextEncoder.');
|
||||
|
||||
test(function() {
|
||||
assert_throws(new RangeError(), function() { new TextDecoder(input); });
|
||||
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue