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

Side by Side Diff: test/codegen/expect/corelib/regexp/captures_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/captures_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__captures_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 captures_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 VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType( dart.void, [])))();
15 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin g])))();
16 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct ionType(dart.void, [dart.dynamic], [core.String])))();
17 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun ctionType(dart.void, [dart.dynamic], [core.num])))();
18 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core .num])))();
19 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT ype(dart.void, [dart.dynamic])))();
20 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart .definiteFunctionType(core.Match, [core.String, core.RegExp])))();
21 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT ype(core.String, [core.Match])))();
22 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp])) )();
23 captures_test.main = function() {
24 let re = core.RegExp.new("^(((N({)?)|(R)|(U)|(V)|(B)|(H)|(n((n)|(r)|(v)|(h)) ?)|(r(r)?)|(v)|(b((n)|(b))?)|(h))|((Y)|(A)|(E)|(o(u)?)|(p(u)?)|(q(u)?)|(s)|(t)|( u)|(w)|(x(u)?)|(y)|(z)|(a((T)|(A)|(L))?)|(c)|(e)|(f(u)?)|(g(u)?)|(i)|(j)|(l)|(m( u)?)))+");
25 let str = "Avtnennan gunzvmu pubExnY nEvln vaTxh rmuhguhaTxnY";
26 v8_regexp_utils.assertTrue(re.hasMatch(str));
27 };
28 dart.fn(captures_test.main, VoidTovoid$());
29 v8_regexp_utils.assertEquals = function(actual, expected, message) {
30 if (message === void 0) message = null;
31 expect$.Expect.equals(actual, expected, message);
32 };
33 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
34 v8_regexp_utils.assertTrue = function(actual, message) {
35 if (message === void 0) message = null;
36 expect$.Expect.isTrue(actual, message);
37 };
38 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
39 v8_regexp_utils.assertFalse = function(actual, message) {
40 if (message === void 0) message = null;
41 expect$.Expect.isFalse(actual, message);
42 };
43 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
44 v8_regexp_utils.assertThrows = function(fn, testid) {
45 if (testid === void 0) testid = null;
46 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
47 };
48 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
49 v8_regexp_utils.assertNull = function(actual, testid) {
50 if (testid === void 0) testid = null;
51 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
52 };
53 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
54 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
55 let actual = [];
56 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
57 let g = dart.dsend(match, 'group', i);
58 actual[dartx.add](g == null ? "" : g);
59 }
60 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
61 };
62 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
63 v8_regexp_utils.shouldBeTrue = function(actual) {
64 expect$.Expect.isTrue(actual);
65 };
66 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
67 v8_regexp_utils.shouldBeFalse = function(actual) {
68 expect$.Expect.isFalse(actual);
69 };
70 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
71 v8_regexp_utils.shouldBeNull = function(actual) {
72 expect$.Expect.isNull(actual);
73 };
74 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
75 v8_regexp_utils.shouldBe = function(actual, expected, message) {
76 if (message === void 0) message = null;
77 if (expected == null) {
78 expect$.Expect.isNull(actual, message);
79 } else {
80 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
81 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
82 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
83 }
84 }
85 };
86 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
87 v8_regexp_utils.firstMatch = function(str, pattern) {
88 return pattern.firstMatch(str);
89 };
90 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
91 v8_regexp_utils.allStringMatches = function(str, pattern) {
92 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
93 };
94 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
95 v8_regexp_utils.description = function(str) {
96 };
97 dart.fn(v8_regexp_utils.description, dynamicTovoid());
98 // Exports:
99 exports.captures_test = captures_test;
100 exports.v8_regexp_utils = v8_regexp_utils;
101 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/capture_test.js ('k') | test/codegen/expect/corelib/regexp/char-insensitive_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698