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

Side by Side Diff: tests/lib_strong/convert/utf8_encode_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 List<int> encode(String str) => new Utf8Encoder().convert(str); 9 List<int> encode(String str) => new Utf8Encoder().convert(str);
10 List<int> encode2(String str) => UTF8.encode(str); 10 List<int> encode2(String str) => UTF8.encode(str);
(...skipping 18 matching lines...) Expand all
29 encoder.convert(ascii, 0)); 29 encoder.convert(ascii, 0));
30 Expect.listEquals([0x41, 0x42, 0x43, 0x44, 0x45], 30 Expect.listEquals([0x41, 0x42, 0x43, 0x44, 0x45],
31 encoder.convert(ascii, 0, 5)); 31 encoder.convert(ascii, 0, 5));
32 Expect.listEquals([0x42, 0x43, 0x44, 0x45], 32 Expect.listEquals([0x42, 0x43, 0x44, 0x45],
33 encoder.convert(ascii, 1)); 33 encoder.convert(ascii, 1));
34 Expect.listEquals([0x41, 0x42, 0x43, 0x44], 34 Expect.listEquals([0x41, 0x42, 0x43, 0x44],
35 encoder.convert(ascii, 0, 4)); 35 encoder.convert(ascii, 0, 4));
36 Expect.listEquals([0x42, 0x43, 0x44], 36 Expect.listEquals([0x42, 0x43, 0x44],
37 encoder.convert(ascii, 1, 4)); 37 encoder.convert(ascii, 1, 4));
38 38
39 Expect.throws(() => encoder.convert(ascii, -1)); // start < 0. 39 Expect.throws(() => encoder.convert(ascii, -1)); // start < 0.
40 Expect.throws(() => encoder.convert(ascii, 6)); // start > length 40 Expect.throws(() => encoder.convert(ascii, 6)); // start > length
41 Expect.throws(() => encoder.convert(ascii, 0, -1)); // end < 0 41 Expect.throws(() => encoder.convert(ascii, 0, -1)); // end < 0
42 Expect.throws(() => encoder.convert(ascii, 0, 6)); // end > length 42 Expect.throws(() => encoder.convert(ascii, 0, 6)); // end > length
sra1 2017/03/21 03:01:09 fix
43 Expect.throws(() => encoder.convert(ascii, 3, 2)); // end < start 43 Expect.throws(() => encoder.convert(ascii, 3, 2)); // end < start
44 44
45 var unicode = "\u0081\u0082\u1041\u{10101}"; 45 var unicode = "\u0081\u0082\u1041\u{10101}";
46 46
47 Expect.listEquals([0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81, 47 Expect.listEquals([0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81,
48 0xf0, 0x90, 0x84, 0x81], 48 0xf0, 0x90, 0x84, 0x81],
49 encoder.convert(unicode)); 49 encoder.convert(unicode));
50 Expect.listEquals([0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81, 50 Expect.listEquals([0xc2, 0x81, 0xc2, 0x82, 0xe1, 0x81, 0x81,
51 0xf0, 0x90, 0x84, 0x81], 51 0xf0, 0x90, 0x84, 0x81],
52 encoder.convert(unicode, 0, unicode.length)); 52 encoder.convert(unicode, 0, unicode.length));
53 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81, 53 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81,
54 0xf0, 0x90, 0x84, 0x81], 54 0xf0, 0x90, 0x84, 0x81],
55 encoder.convert(unicode, 1)); 55 encoder.convert(unicode, 1));
56 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81], 56 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81],
57 encoder.convert(unicode, 1, 3)); 57 encoder.convert(unicode, 1, 3));
58 // Split in the middle of a surrogate pair. 58 // Split in the middle of a surrogate pair.
59 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81, 59 Expect.listEquals([0xc2, 0x82, 0xe1, 0x81, 0x81,
60 0xed, 0xa0, 0x80], 60 0xed, 0xa0, 0x80],
61 encoder.convert(unicode, 1, 4)); 61 encoder.convert(unicode, 1, 4));
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698