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

Side by Side Diff: test/codegen/expect/corelib/regexp/toString_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/toString_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__toString_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 toString_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 dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.cons tFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
15 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun ctionType(dart.dynamic, [dart.dynamic])))();
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 toString_test.main = function() {
26 function testForwardSlash(pattern, _string) {
27 let string = _string;
28 let re1 = core.RegExp.new(core.String._check(pattern));
29 return re1.hasMatch(core.String._check(string));
30 }
31 dart.fn(testForwardSlash, dynamicAnddynamicTodynamic());
32 function testLineTerminator(pattern) {
33 let re1 = core.RegExp.new(core.String._check(pattern));
34 return core.RegExp.new("\\n|\\r|\\u2028|\\u2029").hasMatch(re1.toString()) ;
35 }
36 dart.fn(testLineTerminator, dynamicTodynamic());
37 v8_regexp_utils.shouldBeTrue(testForwardSlash("^/$", "/"));
38 v8_regexp_utils.shouldBeTrue(testForwardSlash("^/$", "/"));
39 v8_regexp_utils.shouldBeTrue(testForwardSlash("^\\/$", "/"));
40 v8_regexp_utils.shouldBeTrue(testForwardSlash("^\\\\/$", "\\/"));
41 v8_regexp_utils.shouldBeTrue(testForwardSlash("^\\\\\\/$", "\\/"));
42 v8_regexp_utils.shouldBeTrue(testForwardSlash("^\\\\\\\\/$", "\\\\/"));
43 v8_regexp_utils.shouldBeTrue(testForwardSlash("^\\\\\\\\\\/$", "\\\\/"));
44 v8_regexp_utils.shouldBeTrue(testForwardSlash("x/x/x", "x/x/x"));
45 v8_regexp_utils.shouldBeTrue(testForwardSlash("x\\/x/x", "x/x/x"));
46 v8_regexp_utils.shouldBeTrue(testForwardSlash("x/x\\/x", "x/x/x"));
47 v8_regexp_utils.shouldBeTrue(testForwardSlash("x\\/x\\/x", "x/x/x"));
48 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\n"));
49 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\\\n"));
50 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\r"));
51 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\\\r"));
52 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\u2028"));
53 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\\\u2028"));
54 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\u2029"));
55 v8_regexp_utils.shouldBeFalse(testLineTerminator("\\\\u2029"));
56 };
57 dart.fn(toString_test.main, VoidTovoid$());
58 v8_regexp_utils.assertEquals = function(actual, expected, message) {
59 if (message === void 0) message = null;
60 expect$.Expect.equals(actual, expected, message);
61 };
62 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
63 v8_regexp_utils.assertTrue = function(actual, message) {
64 if (message === void 0) message = null;
65 expect$.Expect.isTrue(actual, message);
66 };
67 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
68 v8_regexp_utils.assertFalse = function(actual, message) {
69 if (message === void 0) message = null;
70 expect$.Expect.isFalse(actual, message);
71 };
72 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
73 v8_regexp_utils.assertThrows = function(fn, testid) {
74 if (testid === void 0) testid = null;
75 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
76 };
77 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
78 v8_regexp_utils.assertNull = function(actual, testid) {
79 if (testid === void 0) testid = null;
80 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
81 };
82 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
83 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
84 let actual = [];
85 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
86 let g = dart.dsend(match, 'group', i);
87 actual[dartx.add](g == null ? "" : g);
88 }
89 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
90 };
91 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
92 v8_regexp_utils.shouldBeTrue = function(actual) {
93 expect$.Expect.isTrue(actual);
94 };
95 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
96 v8_regexp_utils.shouldBeFalse = function(actual) {
97 expect$.Expect.isFalse(actual);
98 };
99 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
100 v8_regexp_utils.shouldBeNull = function(actual) {
101 expect$.Expect.isNull(actual);
102 };
103 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
104 v8_regexp_utils.shouldBe = function(actual, expected, message) {
105 if (message === void 0) message = null;
106 if (expected == null) {
107 expect$.Expect.isNull(actual, message);
108 } else {
109 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
110 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
111 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
112 }
113 }
114 };
115 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
116 v8_regexp_utils.firstMatch = function(str, pattern) {
117 return pattern.firstMatch(str);
118 };
119 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
120 v8_regexp_utils.allStringMatches = function(str, pattern) {
121 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
122 };
123 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
124 v8_regexp_utils.description = function(str) {
125 };
126 dart.fn(v8_regexp_utils.description, dynamicTovoid());
127 // Exports:
128 exports.toString_test = toString_test;
129 exports.v8_regexp_utils = v8_regexp_utils;
130 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/standalones_test.js ('k') | test/codegen/expect/corelib/regexp/unicode-handling_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698