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

Side by Side Diff: tests/corelib/string_trim_unicode_test.dart

Issue 11411092: Revert "Add some support for the code-point code-unit distinction." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 // 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class Range {
6 final int from;
7 final int to;
8 const Range(this.from, this.to);
9 }
10
11 class StringTrimTest {
12 static testMain() {
13 var spaces = [
14 const Range(9, 13), // Control characters, not in the Zs category.
15 const Range(32, 32),
16 const Range(0xa0, 0xa0),
17 const Range(0x1680, 0x1680),
18 const Range(0x180e, 0x180e),
19 const Range(0x2000, 0x200a),
20 // LINE SEPARATOR, category Zl and PARAGRAPH SEPARATOR, category Zp.
21 const Range(0x2028, 0x2029),
22 const Range(0x202f, 0x202f),
23 const Range(0x205f, 0x205f),
24 const Range(0x3000, 0x3000),
25 const Range(0xfeff, 0xfeff)]; // Unicode BOM.
26 for (int range in spaces) {
27 for (int i = range.from - 1; i <= range.to + 1; i++) {
28 print("Check $i");
29 if (i >= range.from && i <= range.to) {
30 Expect.equals(
31 new String.fromCharCodes([i, 'f'.charCodeAt(0), i]).trim(), 'f');
32 } else {
33 Expect.isFalse('f' ==
34 new String.fromCharCodes([i, 'f'.charCodeAt(0), i]).trim());
35 }
36 }
37 }
38 // 0x85 NEL Next line is not in the Unicode Zs category and it not special
39 // cased in the ES5 spec either.
40 Expect.isFalse('f' ==
41 new String.fromCharCodes([0x85, 'f'.charCodeAt(0), 0x85]).trim());
42 }
43 }
44
45 main() {
46 StringTrimTest.testMain();
47 }
OLDNEW
« no previous file with comments | « tests/corelib/string_from_list_test.dart ('k') | tests/corelib/surrogate_pair_toUpper_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698