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

Side by Side Diff: test/codegen/expect/corelib/regexp/capture_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/capture_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__capture_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 capture_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 capture_test.main = function() {
26 v8_regexp_utils.assertEquals(true, core.RegExp.new("(x)?\\1y").hasMatch("y") );
27 v8_regexp_utils.shouldBe(core.RegExp.new("(x)?\\1y").firstMatch("y"), JSArra yOfString().of(["y", null]));
28 v8_regexp_utils.shouldBe(core.RegExp.new("(x)?y").firstMatch("y"), JSArrayOf String().of(["y", null]));
29 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch("y", core.RegExp.new("(x )?\\1y")), JSArrayOfString().of(["y", null]));
30 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch("y", core.RegExp.new("(x )?y")), JSArrayOfString().of(["y", null]));
31 v8_regexp_utils.shouldBe(v8_regexp_utils.firstMatch("y", core.RegExp.new("(x )?\\1y")), JSArrayOfString().of(["y", null]));
32 expect$.Expect.listEquals(JSArrayOfString().of(["", ""]), "y"[dartx.split](c ore.RegExp.new("(x)?\\1y")));
33 expect$.Expect.listEquals(JSArrayOfString().of(["", ""]), "y"[dartx.split](c ore.RegExp.new("(x)?y")));
34 v8_regexp_utils.assertEquals(0, "y"[dartx.indexOf](core.RegExp.new("(x)?\\1y ")));
35 v8_regexp_utils.assertEquals("z", "y"[dartx.replaceAll](core.RegExp.new("(x) ?\\1y"), "z"));
36 v8_regexp_utils.shouldBe(core.RegExp.new("^(b+|a){1,2}?bc").firstMatch("bbc" ), JSArrayOfString().of(["bbc", "b"]));
37 v8_regexp_utils.shouldBe(core.RegExp.new("((\\3|b)\\2(a)){2,}").firstMatch(" bbaababbabaaaaabbaaaabba"), JSArrayOfString().of(["bbaa", "a", "", "a"]));
38 v8_regexp_utils.firstMatch("", core.RegExp.new("((a|i|A|I|u|o|U|O)(s|c|b|c|d |f|g|h|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z|B|C|D|F|G|H|J|K|L|M|N|P|Q|R|S|T|V|W|X|Y|Z)* ) de\\/da([.,!?\\s]|$)"));
39 };
40 dart.fn(capture_test.main, VoidTovoid$());
41 v8_regexp_utils.assertEquals = function(actual, expected, message) {
42 if (message === void 0) message = null;
43 expect$.Expect.equals(actual, expected, message);
44 };
45 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
46 v8_regexp_utils.assertTrue = function(actual, message) {
47 if (message === void 0) message = null;
48 expect$.Expect.isTrue(actual, message);
49 };
50 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
51 v8_regexp_utils.assertFalse = function(actual, message) {
52 if (message === void 0) message = null;
53 expect$.Expect.isFalse(actual, message);
54 };
55 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
56 v8_regexp_utils.assertThrows = function(fn, testid) {
57 if (testid === void 0) testid = null;
58 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid} `);
59 };
60 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
61 v8_regexp_utils.assertNull = function(actual, testid) {
62 if (testid === void 0) testid = null;
63 expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
64 };
65 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
66 v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
67 let actual = [];
68 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo unt'))); i++) {
69 let g = dart.dsend(match, 'group', i);
70 actual[dartx.add](g == null ? "" : g);
71 }
72 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}` );
73 };
74 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid()) ;
75 v8_regexp_utils.shouldBeTrue = function(actual) {
76 expect$.Expect.isTrue(actual);
77 };
78 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
79 v8_regexp_utils.shouldBeFalse = function(actual) {
80 expect$.Expect.isFalse(actual);
81 };
82 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
83 v8_regexp_utils.shouldBeNull = function(actual) {
84 expect$.Expect.isNull(actual);
85 };
86 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
87 v8_regexp_utils.shouldBe = function(actual, expected, message) {
88 if (message === void 0) message = null;
89 if (expected == null) {
90 expect$.Expect.isNull(actual, message);
91 } else {
92 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa d(actual, 'groupCount'), '+', 1));
93 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou pCount'))); i++) {
94 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou p', i), message);
95 }
96 }
97 };
98 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
99 v8_regexp_utils.firstMatch = function(str, pattern) {
100 return pattern.firstMatch(str);
101 };
102 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
103 v8_regexp_utils.allStringMatches = function(str, pattern) {
104 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group( 0), MatchToString()))[dartx.toList]();
105 };
106 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
107 v8_regexp_utils.description = function(str) {
108 };
109 dart.fn(v8_regexp_utils.description, dynamicTovoid());
110 // Exports:
111 exports.capture_test = capture_test;
112 exports.v8_regexp_utils = v8_regexp_utils;
113 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/regexp/capture-3_test.js ('k') | test/codegen/expect/corelib/regexp/captures_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698