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

Unified Diff: test/codegen/expect/language/closure_in_constructor_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/language/closure_in_constructor_test.js
diff --git a/test/codegen/expect/language/closure_in_constructor_test.js b/test/codegen/expect/language/closure_in_constructor_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..96c0efb52ea32e548d8ab45c447c0a12a54a6fc0
--- /dev/null
+++ b/test/codegen/expect/language/closure_in_constructor_test.js
@@ -0,0 +1,53 @@
+dart_library.library('language/closure_in_constructor_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__closure_in_constructor_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const closure_in_constructor_test = Object.create(null);
+ let A = () => (A = dart.constFn(closure_in_constructor_test.A$()))();
+ let AOfint = () => (AOfint = dart.constFn(closure_in_constructor_test.A$(core.int)))();
+ let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
+ let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String)))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ closure_in_constructor_test.A$ = dart.generic(T => {
+ let AOfT = () => (AOfT = dart.constFn(closure_in_constructor_test.A$(T)))();
+ let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))();
+ let VoidToListOfT = () => (VoidToListOfT = dart.constFn(dart.definiteFunctionType(ListOfT(), [])))();
+ class A extends core.Object {
+ static factory() {
+ return new (AOfT())(dart.fn(() => ListOfT().new(), VoidToListOfT()));
+ }
+ new(closure) {
+ if (closure === void 0) closure = null;
+ this.closure = closure;
+ if (this.closure == null) {
+ this.closure = dart.fn(() => ListOfT().new(), VoidToListOfT());
+ }
+ }
+ }
+ dart.addTypeTests(A);
+ dart.setSignature(A, {
+ constructors: () => ({
+ factory: dart.definiteFunctionType(closure_in_constructor_test.A$(T), []),
+ new: dart.definiteFunctionType(closure_in_constructor_test.A$(T), [], [dart.dynamic])
+ })
+ });
+ return A;
+ });
+ closure_in_constructor_test.A = A();
+ closure_in_constructor_test.main = function() {
+ expect$.Expect.isTrue(core.List.is(dart.dsend(closure_in_constructor_test.A.factory(), 'closure')));
+ expect$.Expect.isTrue(core.List.is(dart.dsend(new closure_in_constructor_test.A(), 'closure')));
+ expect$.Expect.isTrue(ListOfint().is(dart.dsend(AOfint().factory(), 'closure')));
+ expect$.Expect.isTrue(ListOfint().is(dart.dsend(new (AOfint())(), 'closure')));
+ expect$.Expect.isFalse(ListOfString().is(dart.dsend(AOfint().factory(), 'closure')));
+ expect$.Expect.isFalse(ListOfString().is(dart.dsend(new (AOfint())(), 'closure')));
+ };
+ dart.fn(closure_in_constructor_test.main, VoidTodynamic());
+ // Exports:
+ exports.closure_in_constructor_test = closure_in_constructor_test;
+});
« no previous file with comments | « test/codegen/expect/language/closure_cycles_test.js ('k') | test/codegen/expect/language/closure_in_field_initializer_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698