mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +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
|
@ -0,0 +1,46 @@
|
|||
// META: title=Encoding API: USVString surrogate handling when encoding
|
||||
|
||||
var bad = [
|
||||
{
|
||||
input: '\uD800',
|
||||
expected: '\uFFFD',
|
||||
name: 'lone surrogate lead'
|
||||
},
|
||||
{
|
||||
input: '\uDC00',
|
||||
expected: '\uFFFD',
|
||||
name: 'lone surrogate trail'
|
||||
},
|
||||
{
|
||||
input: '\uD800\u0000',
|
||||
expected: '\uFFFD\u0000',
|
||||
name: 'unmatched surrogate lead'
|
||||
},
|
||||
{
|
||||
input: '\uDC00\u0000',
|
||||
expected: '\uFFFD\u0000',
|
||||
name: 'unmatched surrogate trail'
|
||||
},
|
||||
{
|
||||
input: '\uDC00\uD800',
|
||||
expected: '\uFFFD\uFFFD',
|
||||
name: 'swapped surrogate pair'
|
||||
},
|
||||
{
|
||||
input: '\uD834\uDD1E',
|
||||
expected: '\uD834\uDD1E',
|
||||
name: 'properly encoded MUSICAL SYMBOL G CLEF (U+1D11E)'
|
||||
}
|
||||
];
|
||||
|
||||
bad.forEach(function(t) {
|
||||
test(function() {
|
||||
var encoded = new TextEncoder().encode(t.input);
|
||||
var decoded = new TextDecoder().decode(encoded);
|
||||
assert_equals(decoded, t.expected);
|
||||
}, 'USVString handling: ' + t.name);
|
||||
});
|
||||
|
||||
test(function() {
|
||||
assert_equals(new TextEncoder().encode().length, 0, 'Should default to empty string');
|
||||
}, 'USVString default');
|
Loading…
Add table
Add a link
Reference in a new issue