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

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

Issue 196533015: Fix bug in trim introduced by rewrite. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: without debug prints. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/js_string.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 const WHITESPACE = const [ 7 const WHITESPACE = const [
8 0x09, 8 0x09,
9 0x0A, 9 0x0A,
10 0x0B, 10 0x0B,
(...skipping 18 matching lines...) Expand all
29 0x202F, 29 0x202F,
30 0x205F, 30 0x205F,
31 0x3000, 31 0x3000,
32 0x2028, 32 0x2028,
33 0x2029, 33 0x2029,
34 0xFEFF, 34 0xFEFF,
35 ]; 35 ];
36 36
37 main() { 37 main() {
38 for (var ws in WHITESPACE) { 38 for (var ws in WHITESPACE) {
39 Expect.equals("", new String.fromCharCode(ws).trim()); 39 var name = ws.toRadixString(16);
40 var c = new String.fromCharCode(ws);
41 Expect.equals("", c.trim(), "$name");
42 Expect.equals("a", ("a" + c).trim(), "a-$name");
43 Expect.equals("a", (c + "a").trim(), "$name-a");
44 Expect.equals("a", (c + c + "a" + c + c).trim(), "$name around");
45 Expect.equals("a" + c + "a", (c + c + "a" + c + "a" + c + c).trim(),
46 "$name many");
40 } 47 }
41 Expect.equals("", new String.fromCharCodes(WHITESPACE).trim()); 48 Expect.equals("", new String.fromCharCodes(WHITESPACE).trim(), "ALL");
42 for (var ws in WHITESPACE) {
43 var c = new String.fromCharCode(ws);
44 Expect.equals("a", ("a" + c).trim());
45 Expect.equals("a", (c + "a").trim());
46 Expect.equals("a", (c + c + "a" + c + c).trim());
47 Expect.equals("a" + c + "a", (c + c + "a" + c + "a" + c + c).trim());
48 }
49 } 49 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_string.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698