mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
f3629d1236
--HG-- rename : testing/web-platform/tests/conformance-checkers/html/media-queries/023-isvalid.html => testing/web-platform/tests/conformance-checkers/html/media-queries/device-aspect-ratio-novalid.html rename : testing/web-platform/tests/conformance-checkers/html/media-queries/004-isvalid.html => testing/web-platform/tests/conformance-checkers/html/media-queries/projection-novalid.html rename : testing/web-platform/tests/conformance-checkers/html/media-queries/021-isvalid.html => testing/web-platform/tests/conformance-checkers/html/media-queries/tv-novalid.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001-1.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001a.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001b.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002-1.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002a.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002b.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003-1.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003a.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003b.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004-1.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004a.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004b.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005-1.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005a.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html rename : testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005b.html => testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html rename : testing/web-platform/tests/subresource-integrity/crossorigin-anon.js.headers => testing/web-platform/tests/subresource-integrity/crossorigin-anon-script.js.headers rename : testing/web-platform/tests/subresource-integrity/crossorigin-anon.js.headers => testing/web-platform/tests/subresource-integrity/crossorigin-anon-style.css.headers
55 lines
1.3 KiB
HTML
55 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<title>Encoding API: USVString surrogate handling when encoding</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script>
|
|
|
|
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)'
|
|
}
|
|
];
|
|
|
|
var encoding = 'utf-8';
|
|
|
|
bad.forEach(function(t) {
|
|
test(function() {
|
|
var encoded = new TextEncoder(encoding).encode(t.input);
|
|
var decoded = new TextDecoder(encoding).decode(encoded);
|
|
assert_equals(decoded, t.expected);
|
|
}, 'USVString handling: ' + t.name);
|
|
});
|
|
|
|
test(function() {
|
|
assert_equals(new TextEncoder(encoding).encode().length, 0, 'Should default to empty string');
|
|
}, 'USVString default');
|
|
|
|
</script>
|