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

Side by Side Diff: tests/lib/convert/utf8_test.dart

Issue 2763823002: Move spaces from before comments to within comments (Closed)
Patch Set: Fix comments Created 3 years, 9 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'unicode_tests.dart'; 7 import 'unicode_tests.dart';
8 8
9 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes); 9 String decode(List<int> bytes) => new Utf8Decoder().convert(bytes);
10 10
(...skipping 11 matching lines...) Expand all
22 void testDecodeSlice() { 22 void testDecodeSlice() {
23 var decoder = UTF8.decoder; // Doesn't allow malformed. 23 var decoder = UTF8.decoder; // Doesn't allow malformed.
24 var ascii = [0x41, 0x42, 0x43, 0x44, 0x45]; 24 var ascii = [0x41, 0x42, 0x43, 0x44, 0x45];
25 Expect.equals("ABCDE", decoder.convert(ascii)); 25 Expect.equals("ABCDE", decoder.convert(ascii));
26 Expect.equals("ABCDE", decoder.convert(ascii, 0)); 26 Expect.equals("ABCDE", decoder.convert(ascii, 0));
27 Expect.equals("ABCDE", decoder.convert(ascii, 0, ascii.length)); 27 Expect.equals("ABCDE", decoder.convert(ascii, 0, ascii.length));
28 Expect.equals("CDE", decoder.convert(ascii, 2)); 28 Expect.equals("CDE", decoder.convert(ascii, 2));
29 Expect.equals("BCD", decoder.convert(ascii, 1, 4)); 29 Expect.equals("BCD", decoder.convert(ascii, 1, 4));
30 Expect.equals("ABCD", decoder.convert(ascii, 0, 4)); 30 Expect.equals("ABCD", decoder.convert(ascii, 0, 4));
31 31
32 Expect.throws(() => decoder.convert(ascii, -1)); // start < 0. 32 Expect.throws(() => decoder.convert(ascii, -1)); // start < 0.
33 Expect.throws(() => decoder.convert(ascii, 6)); // start > length 33 Expect.throws(() => decoder.convert(ascii, 6)); // start > length
34 Expect.throws(() => decoder.convert(ascii, 0, -1)); // end < 0 34 Expect.throws(() => decoder.convert(ascii, 0, -1)); // end < 0
35 Expect.throws(() => decoder.convert(ascii, 0, 6)); // end > length 35 Expect.throws(() => decoder.convert(ascii, 0, 6)); // end > length
sra1 2017/03/21 03:01:09 fix
36 Expect.throws(() => decoder.convert(ascii, 3, 2)); // end < start 36 Expect.throws(() => decoder.convert(ascii, 3, 2)); // end < start
37 37
38 var utf8 = [0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81]; 38 var utf8 = [0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81];
39 Expect.equals("\u0081\u0082\u1041", decoder.convert(utf8)); 39 Expect.equals("\u0081\u0082\u1041", decoder.convert(utf8));
40 Expect.equals("\u0082\u1041", decoder.convert(utf8, 2)); 40 Expect.equals("\u0082\u1041", decoder.convert(utf8, 2));
41 Expect.equals("\u0081\u0082", decoder.convert(utf8, 0, 4)); 41 Expect.equals("\u0081\u0082", decoder.convert(utf8, 0, 4));
42 Expect.equals("\u0082", decoder.convert(utf8, 2, 4)); 42 Expect.equals("\u0082", decoder.convert(utf8, 2, 4));
43 Expect.throws(() => decoder.convert(utf8, 1)); 43 Expect.throws(() => decoder.convert(utf8, 1));
44 Expect.throws(() => decoder.convert(utf8, 0, 1)); 44 Expect.throws(() => decoder.convert(utf8, 0, 1));
45 Expect.throws(() => decoder.convert(utf8, 2, 5)); 45 Expect.throws(() => decoder.convert(utf8, 2, 5));
(...skipping 28 matching lines...) Expand all
74 testExn([0xC0, 0x80], 0); 74 testExn([0xC0, 0x80], 0);
75 testExn([0xC1, 0xBF], 0); 75 testExn([0xC1, 0xBF], 0);
76 testExn([0xE0, 0x80, 0x80], 0); 76 testExn([0xE0, 0x80, 0x80], 0);
77 testExn([0xE0, 0x9F, 0xBF], 0); 77 testExn([0xE0, 0x9F, 0xBF], 0);
78 testExn([0xF0, 0x80, 0x80, 0x80], 0); 78 testExn([0xF0, 0x80, 0x80, 0x80], 0);
79 testExn([0xF0, 0x8F, 0xBF, 0xBF], 0); 79 testExn([0xF0, 0x8F, 0xBF, 0xBF], 0);
80 // Invalid character (value too large, over 0x10FFFF). 80 // Invalid character (value too large, over 0x10FFFF).
81 testExn([0xF4, 0x90, 0x80, 0x80], 0); 81 testExn([0xF4, 0x90, 0x80, 0x80], 0);
82 testExn([0xF7, 0xBF, 0xBF, 0xBF], 0); 82 testExn([0xF7, 0xBF, 0xBF, 0xBF], 0);
83 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698