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

Side by Side Diff: tests/language/regex/results-cache_test.dart

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed Ivan's comments. Created 6 years, 2 months 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 // Long string to trigger caching.
10 var string =
11 """Friends, Romans, countrymen, lend me your ears!
12 I come to bury Caesar, not to praise him.
13 The evil that men do lives after them,
14 The good is oft interred with their bones;
15 So let it be with Caesar. The noble Brutus
16 Hath told you Caesar was ambitious;
17 If it were so, it was a grievous fault,
18 And grievously hath Caesar answer'd it.
19 Here, under leave of Brutus and the rest-
20 For Brutus is an honorable man;
21 So are they all, all honorable men-
22 Come I to speak in Caesar's funeral.
23 He was my friend, faithful and just to me;
24 But Brutus says he was ambitious,
25 And Brutus is an honorable man.
26 He hath brought many captives home to Rome,
27 Whose ransoms did the general coffers fill.
28 Did this in Caesar seem ambitious?
29 When that the poor have cried, Caesar hath wept;
30 Ambition should be made of sterner stuff:
31 Yet Brutus says he was ambitious,
32 And Brutus is an honorable man.
33 You all did see that on the Lupercal
34 I thrice presented him a kingly crown,
35 Which he did thrice refuse. Was this ambition?
36 Yet Brutus says he was ambitious,
37 And sure he is an honorable man.
38 I speak not to disprove what Brutus spoke,
39 But here I am to speak what I do know.
40 You all did love him once, not without cause;
41 What cause withholds you then to mourn for him?
42 O judgement, thou art fled to brutish beasts,
43 And men have lost their reason. Bear with me;
44 My heart is in the coffin there with Caesar,
45 And I must pause till it come back to me.""";
46
47 var replaced = string.replaceAll(new RegExp(r"\b\w+\b"), "foo");
48 for (var i = 0; i < 3; i++) {
49 assertEquals(replaced,
50 string.replaceAll(new RegExp(r"\b\w+\b"), "foo"));
51 }
52
53 // Check that the result is in a COW array.
54 var words = string.split(" ");
55 assertEquals("Friends,", words[0]);
56 words[0] = "Enemies,";
57 words = string.split(" ");
58 assertEquals("Friends,", words[0]);
59 }
OLDNEW
« no previous file with comments | « tests/language/regex/repeat-match-waldemar_test.dart ('k') | tests/language/regex/stack-overflow2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698