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

Unified Diff: tests/corelib/string_trim2_test.dart

Issue 15348003: Fix string.trim (adding more runes). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add forgotten `static`. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« runtime/lib/string_patch.dart ('K') | « sdk/lib/core/string.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/string_trim2_test.dart
diff --git a/tests/corelib/string_trim2_test.dart b/tests/corelib/string_trim2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2f42c8cdf4a75bf992b5467ac6cc103d432a3027
--- /dev/null
+++ b/tests/corelib/string_trim2_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+const WHITESPACE = const [
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 0x20,
+ 0xA0,
+ 0x85,
+ 0x1680,
+ 0x180E,
+ 0x2000,
+ 0x2001,
+ 0x2002,
+ 0x2003,
+ 0x2004,
+ 0x2005,
+ 0x2006,
+ 0x2007,
+ 0x2008,
+ 0x2009,
+ 0x200A,
+ 0x202F,
+ 0x205F,
+ 0x3000,
+ 0x2028,
+ 0x2029,
+ 0xFEFF,
+];
+
+main() {
+ for (var ws in WHITESPACE) {
+ Expect.equals("", new String.fromCharCode(ws).trim());
+ }
+ Expect.equals("", new String.fromCharCodes(WHITESPACE).trim());
+ for (var ws in WHITESPACE) {
+ var c = new String.fromCharCode(ws);
+ Expect.equals("a", ("a" + c).trim());
+ Expect.equals("a", (c + "a").trim());
+ Expect.equals("a", (c + c + "a" + c + c).trim());
+ }
+}
« runtime/lib/string_patch.dart ('K') | « sdk/lib/core/string.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698