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

Side by Side Diff: LayoutTests/imported/web-platform-tests/encoding/iso-2022-jp-decoder.html

Issue 727883002: update-w3c-deps import using blink 7f8c8ee3e30dc15b7b821c627fc7ac32331d2253: (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 1 month 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
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <script src=../../../resources/testharness.js></script>
4 <script src=../../../resources/testharnessreport.js></script>
5 <div id=log></div>
6 <script>
7 function decode(input, output, desc) {
8 test(function() {
9 var d = new TextDecoder("iso-2022-jp"),
10 buffer = new ArrayBuffer(input.length),
11 view = new Int8Array(buffer)
12 for(var i = 0, l = input.length; i < l; i++) {
13 view[i] = input[i]
14 }
15 assert_equals(d.decode(view), output)
16 }, "iso-2022-jp decoder: " + desc)
17 }
18 decode([0x1b, 0x24], "�$", "Error ESC")
19 decode([0x1b, 0x24, 0x50], "�$P", "Error ESC, character")
20 decode([0x1b, 0x28, 0x42, 0x50], "�P", "ASCII ESC, character")
21 decode([0x1b, 0x28, 0x42, 0x1b, 0x28, 0x42, 0x50], "��P", "Double ASCII ESC, ch aracter")
22 decode([0x50, 0x1b, 0x28, 0x42, 0x50], "PP", "character, ASCII ESC, character")
23 decode([0x5C, 0x5D, 0x7E], "\\]~", "characters")
24 decode([0x0D, 0x0E, 0x0F, 0x10], "\x0D��\x10", "SO / SI")
25
26 decode([0x1b, 0x28, 0x4A, 0x5C, 0x5D, 0x7E], "¥]‾", "Roman ESC, characters")
27 decode([0x1b, 0x28, 0x4A, 0x0D, 0x0E, 0x0F, 0x10], "\x0D��\x10", "Roman ESC, SO / SI")
28 decode([0x1b, 0x28, 0x4A, 0x1b, 0x1b, 0x28, 0x49, 0x50], "�ミ", "Roman ESC, erro r ESC, Katakana ESC")
29
30 decode([0x1b, 0x28, 0x49, 0x50], "ミ", "Katakana ESC, character")
31 decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Katakana ESC, m ultibyte ESC, character")
32 decode([0x1b, 0x28, 0x49, 0x1b, 0x50], "�ミ", "Katakana ESC, error ESC, characte r")
33 decode([0x1b, 0x28, 0x49, 0x1b, 0x24, 0x50], "�、ミ", "Katakana ESC, error ESC #2 , character")
34 decode([0x1b, 0x28, 0x49, 0x50, 0x1b, 0x28, 0x49, 0x50], "ミミ", "Katakana ESC, c haracter, Katakana ESC, character")
35 decode([0x1b, 0x28, 0x49, 0x0D, 0x0E, 0x0F, 0x10], "����", "Katakana ESC, SO / SI")
36
37 decode([0x1b, 0x24, 0x40, 0x50, 0x50], "佩", "Multibyte ESC, character")
38 decode([0x1b, 0x24, 0x42, 0x50, 0x50], "佩", "Multibyte ESC #2, character")
39 decode([0x1b, 0x24, 0x42, 0x1b, 0x50, 0x50], "�佩", "Multibyte ESC, error ESC, c haracter")
40 decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40], "�", "Double multibyte ESC")
41 decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Double multibyt e ESC, character")
42 decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x42, 0x50, 0x50], "�佩", "Double multibyt e ESC #2, character")
43 decode([0x1b, 0x24, 0x40, 0x1b, 0x24, 0x50, 0x50], "�ば�", "Multibyte ESC, error ESC #2, character")
44
45 decode([0x1b, 0x24, 0x40, 0x50, 0x1b, 0x24, 0x40, 0x50, 0x50], "�佩", "Multibyte ESC, single byte, multibyte ESC, character")
46 decode([0x1b, 0x24, 0x40, 0x20, 0x50], "��", "Multibyte ESC, lead error byte")
47 decode([0x1b, 0x24, 0x40, 0x50, 0x20], "�", "Multibyte ESC, trail error byte")
48
49 decode([0x50, 0x1b], "P�", "character, error ESC")
50 decode([0x50, 0x1b, 0x24], "P�$", "character, error ESC #2")
51 decode([0x50, 0x1b, 0x50], "P�P", "character, error ESC #3")
52 decode([0x50, 0x1b, 0x28, 0x42], "P", "character, ASCII ESC")
53 decode([0x50, 0x1b, 0x28, 0x4A], "P", "character, Roman ESC")
54 decode([0x50, 0x1b, 0x28, 0x49], "P", "character, Katakana ESC")
55 decode([0x50, 0x1b, 0x24, 0x40], "P", "character, Multibyte ESC")
56 decode([0x50, 0x1b, 0x24, 0x42], "P", "character, Multibyte ESC #2")
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698