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

Side by Side Diff: tests/corelib/regexp/UC16_test.dart

Issue 667043003: Port regexp tests from V8 to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: dart authors copyright Created 6 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. All rights reserved.
2 // Copyright 2008 the V8 project authors. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following
11 // disclaimer in the documentation and/or other materials provided
12 // with the distribution.
13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived
15 // from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import 'v8_regexp_utils.dart';
30 import 'package:expect/expect.dart';
31
32 void main() {
33 // UC16
34 // Characters used:
35 // "\u03a3\u03c2\u03c3\u039b\u03bb" - Sigma, final sigma, sigma, Lambda, lamda
36 shouldBe(new RegExp(r"x(.)\1x", caseSensitive: false).firstMatch("x\u03a3\u03c 3x"),
37 ["x\u03a3\u03c3x", "\u03a3"], "backref-UC16");
38 assertFalse(new RegExp(r"x(...)\1", caseSensitive: false).hasMatch("x\u03a3\u0 3c2\u03c3\u03c2\u03c3"),
39 "\1 ASCII, string short");
40 assertTrue(new RegExp(r"\u03a3((?:))\1\1x", caseSensitive: false).hasMatch("\u 03c2x"), "backref-UC16-empty");
41 assertTrue(new RegExp(r"x(?:...|(...))\1x", caseSensitive: false).hasMatch("x\ u03a3\u03c2\u03c3x"),
42 "backref-UC16-uncaptured");
43 assertTrue(new RegExp(r"x(?:...|(...))\1x", caseSensitive: false).hasMatch("x\ u03c2\u03c3\u039b\u03a3\u03c2\u03bbx"),
44 "backref-UC16-backtrack");
45 var longUC16String = "x\u03a3\u03c2\u039b\u03c2\u03c3\u03bb\u03c3\u03a3\u03bb" ;
46 shouldBe(new RegExp(r"x(...)\1\1", caseSensitive: false).firstMatch(longUC16St ring),
47 [longUC16String, longUC16String.substring(1,4)],
48 "backref-UC16-twice");
49
50 assertFalse(new RegExp(r"\xc1", caseSensitive: false).hasMatch('fooA'), "quick check-uc16-pattern-ascii-subject");
51 assertFalse(new RegExp(r"[\xe9]").hasMatch('i'), "charclass-uc16-pattern-ascii -subject");
52 assertFalse(new RegExp(r"\u5e74|\u6708").hasMatch('t'), "alternation-uc16-patt ern-ascii-subject");
53 }
OLDNEW
« no previous file with comments | « tests/corelib/regexp/RegExp_test.dart ('k') | tests/corelib/regexp/alternative-length-miscalculation_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698