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

Side by Side Diff: test/codegen/expect/corelib/regexp/bol_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/bol_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__bol_test(exports, dart_sdk, expect) {
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 bol_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 bol_test.main = function() {
26 v8_regexp_utils.description('Test for beginning of line (BOL or ^) matching< /a>');
27 let s = "abc123def456xyzabc789abc999";
28 v8_regexp_utils.shouldBeNull(v8_regexp_utils.firstMatch(s, core.RegExp.new(" ^notHere")));
29 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("^abc ")), JSArrayOfString().of(["abc"]));
30 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("(^|X )abc")), JSArrayOfString().of(["abc", ""]));
31 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("^lon ger|123")), JSArrayOfString().of(["123"]));
32 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("(^ab c|c)123")), JSArrayOfString().of(["abc123", "abc"]));
33 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("(c|^ abc)123")), JSArrayOfString().of(["abc123", "abc"]));
34 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("(^ab |abc)123")), JSArrayOfString().of(["abc123", "abc"]));
35 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s, core.RegExp.new("(bc| ^abc)([0-9]*)a")), JSArrayOfString().of(["bc789a", "bc", "789"]));
36 v8_regexp_utils.shouldBeNull(core.RegExp.new("(?:(Y)X)|(X)").firstMatch("abc "));
37 v8_regexp_utils.shouldBeNull(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch( "abc"));
38 v8_regexp_utils.shouldBeNull(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch( "abcd"));
39 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("Xab cd"), JSArrayOfString().of(["X", null]));
40 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("aXb cd"), JSArrayOfString().of(["X", "X"]));
41 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abX cd"), JSArrayOfString().of(["X", "X"]));
42 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abc Xd"), JSArrayOfString().of(["X", "X"]));
43 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abc dX"), JSArrayOfString().of(["X", "X"]));
44 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("YXa bcd"), JSArrayOfString().of(["YX", null]));
45 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("aYX bcd"), JSArrayOfString().of(["YX", null]));
46 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abY Xcd"), JSArrayOfString().of(["YX", null]));
47 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abc YXd"), JSArrayOfString().of(["YX", null]));
48 v8_regexp_utils.shouldBe(core.RegExp.new("(?:(?:^|Y)X)|(X)").firstMatch("abc dYX"), JSArrayOfString().of(["YX", null]));
49 };
50 dart.fn(bol_test.main, VoidTovoid$());
51 v8_regexp_utils.assertEquals = function(actual, expected, message) {
52 if (message === void 0) message = null;
53 expect$.Expect.equals(actual, expected, message);
54 };
55 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
56 v8_regexp_utils.assertTrue = function(actual, message) {
57 if (message === void 0) message = null;
58 expect$.Expect.isTrue(actual, message);
59 };
60 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
61 v8_regexp_utils.assertFalse = function(actual, message) {
62 if (message === void 0) message = null;
63 expect$.Expect.isFalse(actual, message);
64 };
65 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
66 v8_regexp_utils.assertThrows = function(fn, testid) {
67 if (testid === void 0) testid = null;
68 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
69 };
70 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
71 v8_regexp_utils.assertNull = function(actual, testid) {
72 if (testid === void 0) testid = null;
73 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
74 };
75 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
76 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
77 let actual = [];
78 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
79 let g = dart.dsend(match, 'group', i);
80 actual[dartx.add](g == null ? "" : g);
81 }
82 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
83 };
84 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
85 v8_regexp_utils.shouldBeTrue = function(actual) {
86 expect$.Expect.isTrue(actual);
87 };
88 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
89 v8_regexp_utils.shouldBeFalse = function(actual) {
90 expect$.Expect.isFalse(actual);
91 };
92 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
93 v8_regexp_utils.shouldBeNull = function(actual) {
94 expect$.Expect.isNull(actual);
95 };
96 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
97 v8_regexp_utils.shouldBe = function(actual, expected, message) {
98 if (message === void 0) message = null;
99 if (expected == null) {
100 expect$.Expect.isNull(actual, message);
101 } else {
102 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
103 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
104 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
105 }
106 }
107 };
108 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
109 v8_regexp_utils.firstMatch = function(str, pattern) {
110 return pattern.firstMatch(str);
111 };
112 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
113 v8_regexp_utils.allStringMatches = function(str, pattern) {
114 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
115 };
116 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
117 v8_regexp_utils.description = function(str) {
118 };
119 dart.fn(v8_regexp_utils.description, dynamicTovoid());
120 // Exports:
121 exports.bol_test = bol_test;
122 exports.v8_regexp_utils = v8_regexp_utils;
123 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/bol-with-multiline_test.js ('k') | test/codegen/expect/corelib/regexp/capture-3_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698