| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, 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 // Dart test for testing regular expressions in Dart. | |
| 5 | |
| 6 main() { | |
| 7 String str = "\u{10000}"; | |
| 8 | |
| 9 // Dot will match surrogates too (ideally it should match a pair). | |
| 10 Expect.isTrue(new RegExp(r'^..?$').hasMatch(str)); | |
| 11 | |
| 12 // Surrogate pair in a RegExp. | |
| 13 Expect.isTrue(new RegExp('^\u{10000}\$').hasMatch(str)); | |
| 14 | |
| 15 // Mormon characters should work too. | |
| 16 String mitt = "My name is 𐐣𐐮𐐻"; | |
| 17 Expect.isTrue(new RegExp(r'𐐣𐐮𐐻$').hasMatch(mitt)); | |
| 18 | |
| 19 // Character classes sort of work, but the surrogates are treated as separate | |
| 20 // characters. | |
| 21 Expect.isTrue(new RegExp(r'[𐐣𐐮𐐻]+$').hasMatch(mitt)); | |
| 22 } | |
| OLD | NEW |