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

Unified Diff: test/codegen/expect/language/function_subtype_cast2_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/function_subtype_cast2_test.js
diff --git a/test/codegen/expect/language/function_subtype_cast2_test.js b/test/codegen/expect/language/function_subtype_cast2_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..22688846305cc65e294fee3c543944f9e6d70ec8
--- /dev/null
+++ b/test/codegen/expect/language/function_subtype_cast2_test.js
@@ -0,0 +1,55 @@
+dart_library.library('language/function_subtype_cast2_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__function_subtype_cast2_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 function_subtype_cast2_test = Object.create(null);
+ let Foo = () => (Foo = dart.constFn(function_subtype_cast2_test.Foo$()))();
+ let Class = () => (Class = dart.constFn(function_subtype_cast2_test.Class$()))();
+ let ClassOfint = () => (ClassOfint = dart.constFn(function_subtype_cast2_test.Class$(core.int)))();
+ let ClassOfbool = () => (ClassOfbool = dart.constFn(function_subtype_cast2_test.Class$(core.bool)))();
+ let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
+ let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
+ let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
+ function_subtype_cast2_test.Foo$ = dart.generic(T => {
+ const Foo = dart.typedef('Foo', () => dart.functionType(dart.void, [T]));
+ return Foo;
+ });
+ function_subtype_cast2_test.Foo = Foo();
+ function_subtype_cast2_test.Bar = dart.typedef('Bar', () => dart.functionType(dart.void, [core.int]));
+ function_subtype_cast2_test.Class$ = dart.generic(T => {
+ let FooOfT = () => (FooOfT = dart.constFn(function_subtype_cast2_test.Foo$(T)))();
+ let VoidToFooOfT = () => (VoidToFooOfT = dart.constFn(dart.definiteFunctionType(FooOfT(), [])))();
+ class Class extends core.Object {
+ test(expectedResult, o, typeName) {
+ if (dart.test(expectedResult)) {
+ expect$.Expect.isNotNull(FooOfT().as(o), dart.str`bar as Foo<${typeName}>`);
+ } else {
+ expect$.Expect.throws(dart.fn(() => FooOfT().as(o), VoidToFooOfT()), dart.fn(e => true, dynamicTobool()), dart.str`bar as Foo<${typeName}>`);
+ }
+ expect$.Expect.isNotNull(function_subtype_cast2_test.Bar.as(o), "bar as Bar");
+ }
+ }
+ dart.addTypeTests(Class);
+ dart.setSignature(Class, {
+ methods: () => ({test: dart.definiteFunctionType(dart.dynamic, [core.bool, dart.dynamic, core.String])})
+ });
+ return Class;
+ });
+ function_subtype_cast2_test.Class = Class();
+ function_subtype_cast2_test.bar = function(i) {
+ };
+ dart.fn(function_subtype_cast2_test.bar, intTovoid());
+ function_subtype_cast2_test.main = function() {
+ new function_subtype_cast2_test.Class().test(true, function_subtype_cast2_test.bar, "dynamic");
+ new (ClassOfint())().test(true, function_subtype_cast2_test.bar, "int");
+ new (ClassOfbool())().test(false, function_subtype_cast2_test.bar, "bool");
+ };
+ dart.fn(function_subtype_cast2_test.main, VoidTovoid());
+ // Exports:
+ exports.function_subtype_cast2_test = function_subtype_cast2_test;
+});

Powered by Google App Engine
This is Rietveld 408576698