Update web-platform-tests to revision fef3eb9bbb033d1d7150f4c70ecc1a5f59bcf115

This commit is contained in:
Ms2ger 2015-04-29 21:28:37 +02:00
parent 7ee605db11
commit 14e48d959c
15 changed files with 302 additions and 131 deletions

View file

@ -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>