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

Side by Side Diff: test/codegen/expect/corelib/regexp/alternatives_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/alternatives_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__alternatives_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 alternatives_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 alternatives_test.main = function() {
26 v8_regexp_utils.description('Test regular expression processing with alterna tives.');
27 let s1 = "<p>content</p>";
28 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(( \\\\/([^>]+)>)|(([^>]+)>))")), JSArrayOfString().of(["<p>", "p>", null, null, "p >", "p"]));
29 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(( ABC>)|(\\\\/([^>]+)>)|(([^>]+)>))")), JSArrayOfString().of(["<p>", "p>", null, n ull, null, "p>", "p"]));
30 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(a |\\\\/p|.+?)>")), JSArrayOfString().of(["<p>", "p"]));
31 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(( \\\\/([^>]+)>)|((([^>])+)>))")), JSArrayOfString().of(["<p>", "p>", null, null, "p>", "p", "p"]));
32 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(( ABC>)|(\\\\/([^>]+)>)|((([^>])+)>))")), JSArrayOfString().of(["<p>", "p>", null, null, null, "p>", "p", "p"]));
33 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s1, core.RegExp.new("<(a |\\\\/p|(.)+?)>")), JSArrayOfString().of(["<p>", "p", "p"]));
34 let s2 = "<p>p</p>";
35 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s2, core.RegExp.new("<(( \\\\/([^>]+)>)|(([^>]+)>))\\5")), JSArrayOfString().of(["<p>p", "p>", null, null , "p>", "p"]));
36 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s2, core.RegExp.new("<(( ABC>)|(\\\\/([^>]+)>)|(([^>]+)>))\\6")), JSArrayOfString().of(["<p>p", "p>", nul l, null, null, "p>", "p"]));
37 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch(s2, core.RegExp.new("<(a |\\\\/p|.+?)>\\1")), JSArrayOfString().of(["<p>p", "p"]));
38 };
39 dart.fn(alternatives_test.main, VoidTovoid$());
40 v8_regexp_utils.assertEquals = function(actual, expected, message) {
41 if (message === void 0) message = null;
42 expect$.Expect.equals(actual, expected, message);
43 };
44 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
45 v8_regexp_utils.assertTrue = function(actual, message) {
46 if (message === void 0) message = null;
47 expect$.Expect.isTrue(actual, message);
48 };
49 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
50 v8_regexp_utils.assertFalse = function(actual, message) {
51 if (message === void 0) message = null;
52 expect$.Expect.isFalse(actual, message);
53 };
54 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
55 v8_regexp_utils.assertThrows = function(fn, testid) {
56 if (testid === void 0) testid = null;
57 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
58 };
59 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
60 v8_regexp_utils.assertNull = function(actual, testid) {
61 if (testid === void 0) testid = null;
62 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
63 };
64 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
65 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
66 let actual = [];
67 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
68 let g = dart.dsend(match, 'group', i);
69 actual[dartx.add](g == null ? "" : g);
70 }
71 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
72 };
73 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
74 v8_regexp_utils.shouldBeTrue = function(actual) {
75 expect$.Expect.isTrue(actual);
76 };
77 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
78 v8_regexp_utils.shouldBeFalse = function(actual) {
79 expect$.Expect.isFalse(actual);
80 };
81 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
82 v8_regexp_utils.shouldBeNull = function(actual) {
83 expect$.Expect.isNull(actual);
84 };
85 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
86 v8_regexp_utils.shouldBe = function(actual, expected, message) {
87 if (message === void 0) message = null;
88 if (expected == null) {
89 expect$.Expect.isNull(actual, message);
90 } else {
91 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
92 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
93 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
94 }
95 }
96 };
97 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
98 v8_regexp_utils.firstMatch = function(str, pattern) {
99 return pattern.firstMatch(str);
100 };
101 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
102 v8_regexp_utils.allStringMatches = function(str, pattern) {
103 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
104 };
105 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
106 v8_regexp_utils.description = function(str) {
107 };
108 dart.fn(v8_regexp_utils.description, dynamicTovoid());
109 // Exports:
110 exports.alternatives_test = alternatives_test;
111 exports.v8_regexp_utils = v8_regexp_utils;
112 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698