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

Side by Side Diff: LayoutTests/fast/encoding/api/utf16-surrogates-encode.html

Issue 313993002: Bindings: Add ScalarValueString support (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review feedback Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/utf16-surrogates-encode-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Encoding API: ScalarValueString surrogate handling when encoding</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="resources/shared.js"></script>
6 <script>
7
8 var bad = [
9 {
10 input: '\uD800',
11 expected: '\uFFFD',
12 name: 'lone surrogate lead'
13 },
14 {
15 input: '\uDC00',
16 expected: '\uFFFD',
17 name: 'lone surrogate trail'
18 },
19 {
20 input: '\uD800\u0000',
21 expected: '\uFFFD\u0000',
22 name: 'unmatched surrogate lead'
23 },
24 {
25 input: '\uDC00\u0000',
26 expected: '\uFFFD\u0000',
27 name: 'unmatched surrogate trail'
28 },
29 {
30 input: '\uDC00\uD800',
31 expected: '\uFFFD\uFFFD',
32 name: 'swapped surrogate pair'
33 },
34 {
35 input: '\uD834\uDD1E',
36 expected: '\uD834\uDD1E',
37 name: 'properly encoded MUSICAL SYMBOL G CLEF (U+1D11E)'
38 }
39 ];
40
41 var encoding = 'utf-8';
42
43 bad.forEach(function(t) {
44 test(function() {
45 var encoded = new TextEncoder(encoding).encode(t.input);
46 var decoded = new TextDecoder(encoding).decode(encoded);
47 assert_equals(decoded, t.expected);
48 }, 'ScalarValueString handling: ' + t.name);
49 });
50
51 test(function() {
52 assert_equals(new TextEncoder(encoding).encode().length, 0, 'Should default to empty string');
53 }, 'ScalarValueString default');
54
55 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/utf16-surrogates-encode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698