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

Side by Side Diff: test/codegen/expect/corelib/regexp/capture-3_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
(Empty)
1 dart_library.library('corelib/regexp/capture-3_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__capture$453_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect;
10 const capture$453_test = Object.create(null);
11 const v8_regexp_utils = Object.create(null);
12 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))();
13 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)) )();
14 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
15 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType( dart.void, [])))();
16 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin g])))();
17 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct ionType(dart.void, [dart.dynamic], [core.String])))();
18 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun ctionType(dart.void, [dart.dynamic], [core.num])))();
19 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core .num])))();
20 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
21 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart .definiteFunctionType(core.Match, [core.String, core.RegExp])))();
22 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT ype(core.String, [core.Match])))();
23 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp])) )();
24 capture$453_test.main = function() {
25 function oneMatch(re) {
26 v8_regexp_utils.assertEquals("acd", "abcd"[dartx.replaceAll](core.Pattern. _check(re), ""));
27 }
28 dart.fn(oneMatch, dynamicTodynamic());
29 oneMatch(core.RegExp.new("b"));
30 oneMatch(core.RegExp.new("b"));
31 v8_regexp_utils.assertEquals("acdacd", "abcdabcd"[dartx.replaceAll](core.Reg Exp.new("b"), ""));
32 function captureMatch(re) {
33 let match = v8_regexp_utils.firstMatch("abcd", core.RegExp._check(re));
34 v8_regexp_utils.assertEquals("b", match.group(1));
35 v8_regexp_utils.assertEquals("c", match.group(2));
36 }
37 dart.fn(captureMatch, dynamicTodynamic());
38 captureMatch(core.RegExp.new("(b)(c)"));
39 captureMatch(core.RegExp.new("(b)(c)"));
40 let a = "foo bar baz"[dartx.replaceAll](core.RegExp.new("^|bar"), "");
41 v8_regexp_utils.assertEquals("foo baz", a);
42 a = "foo bar baz"[dartx.replaceAll](core.RegExp.new("^|bar"), "*");
43 v8_regexp_utils.assertEquals("*foo * baz", a);
44 function NoHang(re) {
45 v8_regexp_utils.firstMatch("This is an ASCII string that could take foreve r", core.RegExp._check(re));
46 }
47 dart.fn(NoHang, dynamicTodynamic());
48 NoHang(core.RegExp.new("(((.*)*)*x)Ā"));
49 NoHang(core.RegExp.new("(((.*)*)*Ā)foo"));
50 NoHang(core.RegExp.new("Ā(((.*)*)*x)"));
51 NoHang(core.RegExp.new("(((.*)*)*x)Ā"));
52 NoHang(core.RegExp.new("[ćăĀ](((.*)*)*x)"));
53 NoHang(core.RegExp.new("(((.*)*)*x)[ćăĀ]"));
54 NoHang(core.RegExp.new("[^\\x00-\\xff](((.*)*)*x)"));
55 NoHang(core.RegExp.new("(((.*)*)*x)[^\\x00-\\xff]"));
56 NoHang(core.RegExp.new("(?!(((.*)*)*x)Ā)foo"));
57 NoHang(core.RegExp.new("(?!(((.*)*)*x))Ā"));
58 NoHang(core.RegExp.new("(?=(((.*)*)*x)Ā)foo"));
59 NoHang(core.RegExp.new("(?=(((.*)*)*x))Ā"));
60 NoHang(core.RegExp.new("(?=Ā)(((.*)*)*x)"));
61 NoHang(core.RegExp.new("(æ|ø|Ā)(((.*)*)*x)"));
62 NoHang(core.RegExp.new("(a|b|(((.*)*)*x))Ā"));
63 NoHang(core.RegExp.new("(a|(((.*)*)*x)ă|(((.*)*)*x)Ā)"));
64 let s = "Don't prune based on a repetition of length 0";
65 v8_regexp_utils.assertEquals(null, v8_regexp_utils.firstMatch(s, core.RegExp .new("å{1,1}prune")));
66 v8_regexp_utils.assertEquals("prune", v8_regexp_utils.firstMatch(s, core.Reg Exp.new("å{0,0}prune")).get(0));
67 let regex6 = core.RegExp.new("a*\\u0100*\\w");
68 let input0 = "a";
69 regex6.firstMatch(input0);
70 let re = "Ā*\\w";
71 for (let i = 0; i < 200; i++)
72 re = "a*" + re;
73 let regex7 = core.RegExp.new(re);
74 regex7.firstMatch(input0);
75 let regex8 = core.RegExp.new(re, {caseSensitive: false});
76 regex8.firstMatch(input0);
77 re = "[Ā]*\\w";
78 for (let i = 0; i < 200; i++)
79 re = "a*" + re;
80 let regex9 = core.RegExp.new(re);
81 regex9.firstMatch(input0);
82 let regex10 = core.RegExp.new(re, {caseSensitive: false});
83 regex10.firstMatch(input0);
84 let regex11 = core.RegExp.new("^(?:[^\\u0000-\\u0080]|[0-9a-z?,.!&\\s#()])+$ ", {caseSensitive: false});
85 regex11.firstMatch(input0);
86 let regex12 = core.RegExp.new("u(\\xf0{8}?\\D*?|( ? !)$h??(|)*?(||)+?\\6((?: \\W\\B|--\\d-*-|)?$){0, }?|^Y( ? !1)\\d+)+a");
87 regex12.firstMatch("");
88 };
89 dart.fn(capture$453_test.main, VoidTovoid$());
90 v8_regexp_utils.assertEquals = function(actual, expected, message) {
91 if (message === void 0) message = null;
92 expect$.Expect.equals(actual, expected, message);
93 };
94 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
95 v8_regexp_utils.assertTrue = function(actual, message) {
96 if (message === void 0) message = null;
97 expect$.Expect.isTrue(actual, message);
98 };
99 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
100 v8_regexp_utils.assertFalse = function(actual, message) {
101 if (message === void 0) message = null;
102 expect$.Expect.isFalse(actual, message);
103 };
104 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
105 v8_regexp_utils.assertThrows = function(fn, testid) {
106 if (testid === void 0) testid = null;
107 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
108 };
109 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
110 v8_regexp_utils.assertNull = function(actual, testid) {
111 if (testid === void 0) testid = null;
112 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
113 };
114 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
115 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
116 let actual = [];
117 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
118 let g = dart.dsend(match, 'group', i);
119 actual[dartx.add](g == null ? "" : g);
120 }
121 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
122 };
123 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
124 v8_regexp_utils.shouldBeTrue = function(actual) {
125 expect$.Expect.isTrue(actual);
126 };
127 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
128 v8_regexp_utils.shouldBeFalse = function(actual) {
129 expect$.Expect.isFalse(actual);
130 };
131 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
132 v8_regexp_utils.shouldBeNull = function(actual) {
133 expect$.Expect.isNull(actual);
134 };
135 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
136 v8_regexp_utils.shouldBe = function(actual, expected, message) {
137 if (message === void 0) message = null;
138 if (expected == null) {
139 expect$.Expect.isNull(actual, message);
140 } else {
141 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
142 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
143 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
144 }
145 }
146 };
147 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
148 v8_regexp_utils.firstMatch = function(str, pattern) {
149 return pattern.firstMatch(str);
150 };
151 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
152 v8_regexp_utils.allStringMatches = function(str, pattern) {
153 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
154 };
155 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
156 v8_regexp_utils.description = function(str) {
157 };
158 dart.fn(v8_regexp_utils.description, dynamicTovoid());
159 // Exports:
160 exports.capture$453_test = capture$453_test;
161 exports.v8_regexp_utils = v8_regexp_utils;
162 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/bol_test.js ('k') | test/codegen/expect/corelib/regexp/capture_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698