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

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

Issue 687613002: Revert "Port regexp tests from V8 to Dart." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « tests/corelib/regexp/capture-3_test.dart ('k') | tests/corelib/regexp/captures_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. All rights reserved.
2 // Copyright 2009 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 // Tests from http://blog.stevenlevithan.com/archives/npcg-javascript
34
35 assertEquals(true, new RegExp(r"(x)?\1y").hasMatch("y"));
36 shouldBe(new RegExp(r"(x)?\1y").firstMatch("y"), ["y", null]);
37 shouldBe(new RegExp(r"(x)?y").firstMatch("y"), ["y", null]);
38 shouldBe(firstMatch("y", new RegExp(r"(x)?\1y")), ["y", null]);
39 shouldBe(firstMatch("y", new RegExp(r"(x)?y")), ["y", null]);
40 shouldBe(firstMatch("y", new RegExp(r"(x)?\1y")), ["y", null]);
41 Expect.listEquals(["", ""], "y".split(new RegExp(r"(x)?\1y")));
42 Expect.listEquals(["", ""], "y".split(new RegExp(r"(x)?y")));
43 assertEquals(0, "y".indexOf(new RegExp(r"(x)?\1y")));
44 assertEquals("z", "y".replaceAll(new RegExp(r"(x)?\1y"), "z"));
45
46 // See https://bugzilla.mozilla.org/show_bug.cgi?id=476146
47 shouldBe(new RegExp(r"^(b+|a){1,2}?bc").firstMatch("bbc"), ["bbc", "b"]);
48 shouldBe(new RegExp(r"((\3|b)\2(a)){2,}").firstMatch("bbaababbabaaaaabbaaaabba "),
49 ["bbaa", "a", "", "a"]);
50
51 // From crbug.com/128821 - don't hang:
52 firstMatch("", new RegExp(r"((a|i|A|I|u|o|U|O)(s|c|b|c|d|f|g|h|j|k|l|m|n|p|q|r |s|t|v|w|x|y|z|B|C|D|F|G|H|J|K|L|M|N|P|Q|R|S|T|V|W|X|Y|Z)*) de\/da([.,!?\s]|$)") );
53 }
OLDNEW
« no previous file with comments | « tests/corelib/regexp/capture-3_test.dart ('k') | tests/corelib/regexp/captures_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698