Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/encoding/textencoder-utf16-surrogates.html

Issue 1990653002: Move the encoding directory from web-platform-tests/ to wpt/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Encoding API: USVString surrogate handling when encoding</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script>
6
7 var bad = [
8 {
9 input: '\uD800',
10 expected: '\uFFFD',
11 name: 'lone surrogate lead'
12 },
13 {
14 input: '\uDC00',
15 expected: '\uFFFD',
16 name: 'lone surrogate trail'
17 },
18 {
19 input: '\uD800\u0000',
20 expected: '\uFFFD\u0000',
21 name: 'unmatched surrogate lead'
22 },
23 {
24 input: '\uDC00\u0000',
25 expected: '\uFFFD\u0000',
26 name: 'unmatched surrogate trail'
27 },
28 {
29 input: '\uDC00\uD800',
30 expected: '\uFFFD\uFFFD',
31 name: 'swapped surrogate pair'
32 },
33 {
34 input: '\uD834\uDD1E',
35 expected: '\uD834\uDD1E',
36 name: 'properly encoded MUSICAL SYMBOL G CLEF (U+1D11E)'
37 }
38 ];
39
40 var encoding = 'utf-8';
41
42 bad.forEach(function(t) {
43 test(function() {
44 var encoded = new TextEncoder(encoding).encode(t.input);
45 var decoded = new TextDecoder(encoding).decode(encoded);
46 assert_equals(decoded, t.expected);
47 }, 'USVString handling: ' + t.name);
48 });
49
50 test(function() {
51 assert_equals(new TextEncoder(encoding).encode().length, 0, 'Should default to empty string');
52 }, 'USVString default');
53
54 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698