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

Unified Diff: test/codegen/expect/corelib/regexp/no-extensions_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 side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/corelib/regexp/no-extensions_test.js
diff --git a/test/codegen/expect/corelib/regexp/no-extensions_test.js b/test/codegen/expect/corelib/regexp/no-extensions_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d8a6d63dd62556eaced36ac064606b72cb43dad5
--- /dev/null
+++ b/test/codegen/expect/corelib/regexp/no-extensions_test.js
@@ -0,0 +1,135 @@
+dart_library.library('corelib/regexp/no-extensions_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__no$45extensions_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const _interceptors = dart_sdk._interceptors;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const no$45extensions_test = Object.create(null);
+ const v8_regexp_utils = Object.create(null);
+ let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSArray$(core.String)))();
+ let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void, [])))();
+ let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
+ let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Match])))();
+ let VoidToRegExp = () => (VoidToRegExp = dart.constFn(dart.definiteFunctionType(core.RegExp, [])))();
+ let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
+ let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.String])))();
+ let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.String])))();
+ let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.num])))();
+ let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core.num])))();
+ let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))();
+ let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart.definiteFunctionType(core.Match, [core.String, core.RegExp])))();
+ let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp])))();
+ no$45extensions_test.main = function() {
+ v8_regexp_utils.description('Tests that regular expressions do not have extensions that diverge from the JavaScript specification. ' + 'Because WebKit originally used a copy of PCRE, various non-JavaScript regular expression features were historically present. ' + 'Also tests various related edge cases.');
+ v8_regexp_utils.shouldBeNull(core.RegExp.new("\\\\x{41}").firstMatch("yA1"));
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\x{41}]").firstMatch("yA1").group(0), "1");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\x1g").firstMatch("x1g").group(0), "x1g");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\x1g]").firstMatch("x").group(0), "x");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\x1g]").firstMatch("1").group(0), "1");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\2147483648").firstMatch(core.String.fromCharCode(140) + "7483648").group(0), core.String.fromCharCode(140) + "7483648");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\4294967296").firstMatch("\"94967296").group(0), "\"94967296");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\8589934592").firstMatch("8589934592").group(0), "8589934592");
+ v8_regexp_utils.assertEquals("\nAbc\n"[dartx.replaceAllMapped](core.RegExp.new("(\\n)[^\\n]+$"), dart.fn(m => m.group(1), MatchToString())), "\nAbc\n");
+ v8_regexp_utils.shouldBeNull(core.RegExp.new("x$").firstMatch("x\n"));
+ v8_regexp_utils.assertThrows(dart.fn(() => core.RegExp.new("x++"), VoidToRegExp()));
+ v8_regexp_utils.shouldBeNull(core.RegExp.new("[]]").firstMatch("]"));
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\060").firstMatch("y01").group(0), "0");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\060]").firstMatch("y01").group(0), "0");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\606").firstMatch("y06").group(0), "06");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\606]").firstMatch("y06").group(0), "0");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\606]").firstMatch("y6").group(0), "6");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\101").firstMatch("yA1").group(0), "A");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\101]").firstMatch("yA1").group(0), "A");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\1011").firstMatch("yA1").group(0), "A1");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\1011]").firstMatch("yA1").group(0), "A");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\1011]").firstMatch("y1").group(0), "1");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\10q").firstMatch("y" + core.String.fromCharCode(8) + "q").group(0), core.String.fromCharCode(8) + "q");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\10q]").firstMatch("y" + core.String.fromCharCode(8) + "q").group(0), core.String.fromCharCode(8));
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\1q").firstMatch("y" + core.String.fromCharCode(1) + "q").group(0), core.String.fromCharCode(1) + "q");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\1q]").firstMatch("y" + core.String.fromCharCode(1) + "q").group(0), core.String.fromCharCode(1));
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\1q]").firstMatch("yq").group(0), "q");
+ v8_regexp_utils.assertEquals(core.RegExp.new("\\8q").firstMatch("8q").group(0), "8q");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\8q]").firstMatch("y8q").group(0), "8");
+ v8_regexp_utils.assertEquals(core.RegExp.new("[\\8q]").firstMatch("yq").group(0), "q");
+ v8_regexp_utils.shouldBe(core.RegExp.new("(x)\\1q").firstMatch("xxq"), JSArrayOfString().of(["xxq", "x"]));
+ v8_regexp_utils.shouldBe(core.RegExp.new("(x)[\\1q]").firstMatch("xxq"), JSArrayOfString().of(["xq", "x"]));
+ v8_regexp_utils.shouldBe(core.RegExp.new("(x)[\\1q]").firstMatch("xx" + core.String.fromCharCode(1)), JSArrayOfString().of(["x" + core.String.fromCharCode(1), "x"]));
+ };
+ dart.fn(no$45extensions_test.main, VoidTovoid$());
+ v8_regexp_utils.assertEquals = function(actual, expected, message) {
+ if (message === void 0) message = null;
+ expect$.Expect.equals(actual, expected, message);
+ };
+ dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid());
+ v8_regexp_utils.assertTrue = function(actual, message) {
+ if (message === void 0) message = null;
+ expect$.Expect.isTrue(actual, message);
+ };
+ dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid());
+ v8_regexp_utils.assertFalse = function(actual, message) {
+ if (message === void 0) message = null;
+ expect$.Expect.isFalse(actual, message);
+ };
+ dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid());
+ v8_regexp_utils.assertThrows = function(fn, testid) {
+ if (testid === void 0) testid = null;
+ expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid}`);
+ };
+ dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$());
+ v8_regexp_utils.assertNull = function(actual, testid) {
+ if (testid === void 0) testid = null;
+ expect$.Expect.isNull(actual, dart.str`Test ${testid}`);
+ };
+ dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$());
+ v8_regexp_utils.assertToStringEquals = function(str, match, testid) {
+ let actual = [];
+ for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCount'))); i++) {
+ let g = dart.dsend(match, 'group', i);
+ actual[dartx.add](g == null ? "" : g);
+ }
+ expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}`);
+ };
+ dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid());
+ v8_regexp_utils.shouldBeTrue = function(actual) {
+ expect$.Expect.isTrue(actual);
+ };
+ dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid());
+ v8_regexp_utils.shouldBeFalse = function(actual) {
+ expect$.Expect.isFalse(actual);
+ };
+ dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid());
+ v8_regexp_utils.shouldBeNull = function(actual) {
+ expect$.Expect.isNull(actual);
+ };
+ dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid());
+ v8_regexp_utils.shouldBe = function(actual, expected, message) {
+ if (message === void 0) message = null;
+ if (expected == null) {
+ expect$.Expect.isNull(actual, message);
+ } else {
+ expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dload(actual, 'groupCount'), '+', 1));
+ for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'groupCount'))); i++) {
+ expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'group', i), message);
+ }
+ }
+ };
+ dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid());
+ v8_regexp_utils.firstMatch = function(str, pattern) {
+ return pattern.firstMatch(str);
+ };
+ dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch());
+ v8_regexp_utils.allStringMatches = function(str, pattern) {
+ return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group(0), MatchToString()))[dartx.toList]();
+ };
+ dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString());
+ v8_regexp_utils.description = function(str) {
+ };
+ dart.fn(v8_regexp_utils.description, dynamicTovoid());
+ // Exports:
+ exports.no$45extensions_test = no$45extensions_test;
+ exports.v8_regexp_utils = v8_regexp_utils;
+});

Powered by Google App Engine
This is Rietveld 408576698