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

Unified Diff: test/codegen/corelib/string_trim2_test.dart

Issue 1945153002: Add corelib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: error_test and range_error_test now pass Created 4 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
« no previous file with comments | « test/codegen/corelib/string_to_lower_case_test.dart ('k') | test/codegen/corelib/string_trim_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/corelib/string_trim2_test.dart
diff --git a/test/codegen/corelib/string_trim2_test.dart b/test/codegen/corelib/string_trim2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..11379dd77618014c9e72034e4216053b2fd8ee75
--- /dev/null
+++ b/test/codegen/corelib/string_trim2_test.dart
@@ -0,0 +1,49 @@
+// 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 [
+ 0x09,
+ 0x0A,
+ 0x0B,
+ 0x0C,
+ 0x0D,
+ 0x20,
+ 0x85,
+ 0xA0,
+ 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) {
+ var name = ws.toRadixString(16);
+ var c = new String.fromCharCode(ws);
+ Expect.equals("", c.trim(), "$name");
+ Expect.equals("a", ("a" + c).trim(), "a-$name");
+ Expect.equals("a", (c + "a").trim(), "$name-a");
+ Expect.equals("a", (c + c + "a" + c + c).trim(), "$name around");
+ Expect.equals("a" + c + "a", (c + c + "a" + c + "a" + c + c).trim(),
+ "$name many");
+ }
+ Expect.equals("", new String.fromCharCodes(WHITESPACE).trim(), "ALL");
+}
« no previous file with comments | « test/codegen/corelib/string_to_lower_case_test.dart ('k') | test/codegen/corelib/string_trim_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698