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

Side by Side Diff: test/codegen/expect/corelib/regexp/ranges-and-escaped-hyphens_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/ranges-and-escaped-hyphens_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__ranges$45and$45escaped$45hyphens_test(exports, dart_sdk, expec t) {
5 'use strict';
6 const core = dart_sdk.core;
7 const _interceptors = dart_sdk._interceptors;
8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect;
11 const ranges$45and$45escaped$45hyphens_test = Object.create(null);
12 const v8_regexp_utils = Object.create(null);
13 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr ray$(core.String)))();
14 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))();
15 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)) )();
16 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType( dart.void, [])))();
17 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin g])))();
18 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct ionType(dart.void, [dart.dynamic], [core.String])))();
19 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun ctionType(dart.void, [dart.dynamic], [core.num])))();
20 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core .num])))();
21 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
22 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart .definiteFunctionType(core.Match, [core.String, core.RegExp])))();
23 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT ype(core.String, [core.Match])))();
24 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp])) )();
25 ranges$45and$45escaped$45hyphens_test.main = function() {
26 v8_regexp_utils.description('Tests for bug <a href="https://bugs.webkit.org/ show_bug.cgi?id=21232">#21232</a>, and related range issues described in bug.');
27 let regexp01 = core.RegExp.new("[1-35]+").firstMatch("-12354");
28 v8_regexp_utils.shouldBe(regexp01, JSArrayOfString().of(["1235"]));
29 let regexp01a = core.RegExp.new("[\\s1-35]+").firstMatch("-123 54");
30 v8_regexp_utils.shouldBe(regexp01a, JSArrayOfString().of(["123 5"]));
31 let regexp01b = core.RegExp.new("[1\\s-35]+").firstMatch("21-3 54");
32 v8_regexp_utils.shouldBe(regexp01b, JSArrayOfString().of(["1-3 5"]));
33 let regexp01c = core.RegExp.new("[1-\\s35]+").firstMatch("21-3 54");
34 v8_regexp_utils.shouldBe(regexp01c, JSArrayOfString().of(["1-3 5"]));
35 let regexp01d = core.RegExp.new("[1-3\\s5]+").firstMatch("-123 54");
36 v8_regexp_utils.shouldBe(regexp01d, JSArrayOfString().of(["123 5"]));
37 let regexp01e = core.RegExp.new("[1-35\\s5]+").firstMatch("-123 54");
38 v8_regexp_utils.shouldBe(regexp01e, JSArrayOfString().of(["123 5"]));
39 let regexp01f = core.RegExp.new("[-3]+").firstMatch("2-34");
40 v8_regexp_utils.shouldBe(regexp01f, JSArrayOfString().of(["-3"]));
41 let regexp01g = core.RegExp.new("[2-]+").firstMatch("12-3");
42 v8_regexp_utils.shouldBe(regexp01g, JSArrayOfString().of(["2-"]));
43 let regexp02 = core.RegExp.new("[1\\-35]+").firstMatch("21-354");
44 v8_regexp_utils.shouldBe(regexp02, JSArrayOfString().of(["1-35"]));
45 let regexp02a = core.RegExp.new("[\\s1\\-35]+").firstMatch("21-3 54");
46 v8_regexp_utils.shouldBe(regexp02a, JSArrayOfString().of(["1-3 5"]));
47 let regexp02b = core.RegExp.new("[1\\s\\-35]+").firstMatch("21-3 54");
48 v8_regexp_utils.shouldBe(regexp02b, JSArrayOfString().of(["1-3 5"]));
49 let regexp02c = core.RegExp.new("[1\\-\\s35]+").firstMatch("21-3 54");
50 v8_regexp_utils.shouldBe(regexp02c, JSArrayOfString().of(["1-3 5"]));
51 let regexp02d = core.RegExp.new("[1\\-3\\s5]+").firstMatch("21-3 54");
52 v8_regexp_utils.shouldBe(regexp02d, JSArrayOfString().of(["1-3 5"]));
53 let regexp02e = core.RegExp.new("[1\\-35\\s5]+").firstMatch("21-3 54");
54 v8_regexp_utils.shouldBe(regexp02e, JSArrayOfString().of(["1-3 5"]));
55 let regexp03a = core.RegExp.new("[\\--0]+").firstMatch(",-.01");
56 v8_regexp_utils.shouldBe(regexp03a, JSArrayOfString().of(["-.0"]));
57 let regexp03b = core.RegExp.new("[+-\\-]+").firstMatch("*+,-.");
58 v8_regexp_utils.shouldBe(regexp03b, JSArrayOfString().of(["+,-"]));
59 let bug21232 = core.RegExp.new("^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$") .hasMatch('@');
60 v8_regexp_utils.shouldBeFalse(bug21232);
61 };
62 dart.fn(ranges$45and$45escaped$45hyphens_test.main, VoidTovoid$());
63 v8_regexp_utils.assertEquals = function(actual, expected, message) {
64 if (message === void 0) message = null;
65 expect$.Expect.equals(actual, expected, message);
66 };
67 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
68 v8_regexp_utils.assertTrue = function(actual, message) {
69 if (message === void 0) message = null;
70 expect$.Expect.isTrue(actual, message);
71 };
72 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
73 v8_regexp_utils.assertFalse = function(actual, message) {
74 if (message === void 0) message = null;
75 expect$.Expect.isFalse(actual, message);
76 };
77 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
78 v8_regexp_utils.assertThrows = function(fn, testid) {
79 if (testid === void 0) testid = null;
80 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
81 };
82 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
83 v8_regexp_utils.assertNull = function(actual, testid) {
84 if (testid === void 0) testid = null;
85 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
86 };
87 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
88 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
89 let actual = [];
90 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
91 let g = dart.dsend(match, 'group', i);
92 actual[dartx.add](g == null ? "" : g);
93 }
94 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
95 };
96 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
97 v8_regexp_utils.shouldBeTrue = function(actual) {
98 expect$.Expect.isTrue(actual);
99 };
100 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
101 v8_regexp_utils.shouldBeFalse = function(actual) {
102 expect$.Expect.isFalse(actual);
103 };
104 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
105 v8_regexp_utils.shouldBeNull = function(actual) {
106 expect$.Expect.isNull(actual);
107 };
108 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
109 v8_regexp_utils.shouldBe = function(actual, expected, message) {
110 if (message === void 0) message = null;
111 if (expected == null) {
112 expect$.Expect.isNull(actual, message);
113 } else {
114 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
115 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
116 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
117 }
118 }
119 };
120 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
121 v8_regexp_utils.firstMatch = function(str, pattern) {
122 return pattern.firstMatch(str);
123 };
124 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
125 v8_regexp_utils.allStringMatches = function(str, pattern) {
126 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
127 };
128 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
129 v8_regexp_utils.description = function(str) {
130 };
131 dart.fn(v8_regexp_utils.description, dynamicTovoid());
132 // Exports:
133 exports.ranges$45and$45escaped$45hyphens_test = ranges$45and$45escaped$45hyphe ns_test;
134 exports.v8_regexp_utils = v8_regexp_utils;
135 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/range-out-of-order_test.js ('k') | test/codegen/expect/corelib/regexp/regexp_kde_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698