Index: tests/corelib/reg_exp_unicode_test.dart |
diff --git a/tests/corelib/reg_exp_unicode_test.dart b/tests/corelib/reg_exp_unicode_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5cdc0fda12c276b5d93364419bc2427df334da9a |
--- /dev/null |
+++ b/tests/corelib/reg_exp_unicode_test.dart |
@@ -0,0 +1,22 @@ |
+// Copyright (c) 2011, 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. |
+// Dart test for testing regular expressions in Dart. |
+ |
+main() { |
+ String str = "\u{10000}"; |
+ |
+ // Dot will match surrogates too (ideally it should match a pair). |
+ Expect.isTrue(new RegExp(r'^..?$').hasMatch(str)); |
+ |
+ // Surrogate pair in a RegExp. |
+ Expect.isTrue(new RegExp('^\u{10000}\$').hasMatch(str)); |
+ |
+ // Mormon characters should work too. |
+ String mitt = "My name is ๐ฃ๐ฎ๐ป"; |
+ Expect.isTrue(new RegExp(r'๐ฃ๐ฎ๐ป$').hasMatch(mitt)); |
+ |
+ // Character classes sort of work, but the surrogates are treated as separate |
+ // characters. |
+ Expect.isTrue(new RegExp(r'[๐ฃ๐ฎ๐ป]+$').hasMatch(mitt)); |
+} |