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

Side by Side Diff: tests/corelib/regexp/alternatives_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: 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. 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
5 import 'util.dart';
6 import 'package:expect/expect.dart';
7
8 void main() {
9 description(
10 'Test regular expression processing with alternatives.'
11 );
12
13 var s1 = "<p>content</p>";
14 shouldBe(firstMatch(s1, new RegExp(r"<((\\/([^>]+)>)|(([^>]+)>))")), ["<p>","p >",null,null,"p>","p"]);
15 shouldBe(firstMatch(s1, new RegExp(r"<((ABC>)|(\\/([^>]+)>)|(([^>]+)>))")), [" <p>","p>",null,null,null,"p>","p"]);
16 shouldBe(firstMatch(s1, new RegExp(r"<(a|\\/p|.+?)>")), ["<p>","p"]);
17
18 // Force YARR to use Interpreter by using iterative parentheses
19 shouldBe(firstMatch(s1, new RegExp(r"<((\\/([^>]+)>)|((([^>])+)>))")), ["<p>", "p>",null,null,"p>","p","p"]);
20 shouldBe(firstMatch(s1, new RegExp(r"<((ABC>)|(\\/([^>]+)>)|((([^>])+)>))")), ["<p>","p>",null,null,null,"p>","p","p"]);
21 shouldBe(firstMatch(s1, new RegExp(r"<(a|\\/p|(.)+?)>")), ["<p>","p","p"]);
22
23 // Force YARR to use Interpreter by using backreference
24 var s2 = "<p>p</p>";
25 shouldBe(firstMatch(s2, new RegExp(r"<((\\/([^>]+)>)|(([^>]+)>))\5")), ["<p>p" ,"p>",null,null,"p>","p"]);
26 shouldBe(firstMatch(s2, new RegExp(r"<((ABC>)|(\\/([^>]+)>)|(([^>]+)>))\6")), ["<p>p","p>",null,null,null,"p>","p"]);
27 shouldBe(firstMatch(s2, new RegExp(r"<(a|\\/p|.+?)>\1")), ["<p>p","p"]);
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698