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

Side by Side Diff: test/codegen_expected/language/no_such_method_subtype_test.js

Issue 2158173003: fix #603, support mock objects (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: add test 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
1 dart_library.library('language/no_such_method_subtype_test', null, /* Imports */ [ 1 dart_library.library('language/no_such_method_subtype_test', null, /* Imports */ [
2 'dart_sdk', 2 'dart_sdk',
3 'expect' 3 'expect'
4 ], function load__no_such_method_subtype_test(exports, dart_sdk, expect) { 4 ], function load__no_such_method_subtype_test(exports, dart_sdk, expect) {
5 'use strict'; 5 'use strict';
6 const core = dart_sdk.core; 6 const core = dart_sdk.core;
7 const _interceptors = dart_sdk._interceptors; 7 const _interceptors = dart_sdk._interceptors;
8 const dart = dart_sdk.dart; 8 const dart = dart_sdk.dart;
9 const dartx = dart_sdk.dartx; 9 const dartx = dart_sdk.dartx;
10 const expect$ = expect.expect; 10 const expect$ = expect.expect;
11 const no_such_method_subtype_test = Object.create(null); 11 const no_such_method_subtype_test = Object.create(null);
12 let JSArrayOfA = () => (JSArrayOfA = dart.constFn(_interceptors.JSArray$(no_su ch_method_subtype_test.A)))(); 12 let JSArrayOfA = () => (JSArrayOfA = dart.constFn(_interceptors.JSArray$(no_su ch_method_subtype_test.A)))();
13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))(); 13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
14 no_such_method_subtype_test.A = class A extends core.Object { 14 no_such_method_subtype_test.A = class A extends core.Object {
15 foo() { 15 foo() {
16 return 42; 16 return 42;
17 } 17 }
18 }; 18 };
19 dart.setSignature(no_such_method_subtype_test.A, { 19 dart.setSignature(no_such_method_subtype_test.A, {
20 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) 20 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])})
21 }); 21 });
22 no_such_method_subtype_test.B = class B extends core.Object { 22 no_such_method_subtype_test.B = class B extends core.Object {
23 noSuchMethod(im) { 23 noSuchMethod(im) {
24 return 84; 24 return 84;
25 } 25 }
26 foo() {
27 return this.noSuchMethod(new dart.InvocationImpl('foo', [], {isMethod: tru e}));
28 }
26 }; 29 };
27 no_such_method_subtype_test.B[dart.implements] = () => [no_such_method_subtype _test.A]; 30 no_such_method_subtype_test.B[dart.implements] = () => [no_such_method_subtype _test.A];
28 no_such_method_subtype_test.main = function() { 31 no_such_method_subtype_test.main = function() {
29 let a = JSArrayOfA().of([new no_such_method_subtype_test.A(), new no_such_me thod_subtype_test.B()]); 32 let a = JSArrayOfA().of([new no_such_method_subtype_test.A(), new no_such_me thod_subtype_test.B()]);
30 let b = a[dartx.get](1); 33 let b = a[dartx.get](1);
31 if (no_such_method_subtype_test.A.is(b)) { 34 if (no_such_method_subtype_test.A.is(b)) {
32 expect$.Expect.equals(84, b.foo()); 35 expect$.Expect.equals(84, b.foo());
33 return; 36 return;
34 } 37 }
35 expect$.Expect.fail('Should not be here'); 38 expect$.Expect.fail('Should not be here');
36 }; 39 };
37 dart.fn(no_such_method_subtype_test.main, VoidTodynamic()); 40 dart.fn(no_such_method_subtype_test.main, VoidTodynamic());
38 // Exports: 41 // Exports:
39 exports.no_such_method_subtype_test = no_such_method_subtype_test; 42 exports.no_such_method_subtype_test = no_such_method_subtype_test;
40 }); 43 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698