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

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

Issue 2202673002: Adjust method parameters in noSuchMethod helper stubs (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 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_mock_test', null, /* Imports */[ 1 dart_library.library('language/no_such_method_mock_test', null, /* Imports */[
2 'dart_sdk', 2 'dart_sdk',
3 'expect' 3 'expect'
4 ], function load__no_such_method_mock_test(exports, dart_sdk, expect) { 4 ], function load__no_such_method_mock_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 dart = dart_sdk.dart; 7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx; 8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect; 9 const expect$ = expect.expect;
10 const no_such_method_mock_test = Object.create(null); 10 const no_such_method_mock_test = Object.create(null);
(...skipping 11 matching lines...) Expand all
22 methods: () => ({ 22 methods: () => ({
23 eatFood: dart.definiteFunctionType(core.bool, [core.String]), 23 eatFood: dart.definiteFunctionType(core.bool, [core.String]),
24 scratch: dart.definiteFunctionType(core.int, [core.String]) 24 scratch: dart.definiteFunctionType(core.int, [core.String])
25 }) 25 })
26 }); 26 });
27 no_such_method_mock_test.MockCat = class MockCat extends core.Object { 27 no_such_method_mock_test.MockCat = class MockCat extends core.Object {
28 noSuchMethod(invocation) { 28 noSuchMethod(invocation) {
29 return core.String.as(invocation.positionalArguments[dartx.get](0))[dartx. isNotEmpty]; 29 return core.String.as(invocation.positionalArguments[dartx.get](0))[dartx. isNotEmpty];
30 } 30 }
31 eatFood(food) { 31 eatFood(food) {
32 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', [food], {isMethod: true}))); 32 let positionalArgs = [food];
33 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', positionalArgs, {isMethod: true})));
33 } 34 }
34 scratch(furniture) { 35 scratch(furniture) {
35 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , [furniture], {isMethod: true}))); 36 let positionalArgs = [furniture];
37 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , positionalArgs, {isMethod: true})));
36 } 38 }
37 }; 39 };
38 no_such_method_mock_test.MockCat[dart.implements] = () => [no_such_method_mock _test.Cat]; 40 no_such_method_mock_test.MockCat[dart.implements] = () => [no_such_method_mock _test.Cat];
39 no_such_method_mock_test.MockCat2 = class MockCat2 extends no_such_method_mock _test.MockCat { 41 no_such_method_mock_test.MockCat2 = class MockCat2 extends no_such_method_mock _test.MockCat {
40 eatFood(food) { 42 eatFood(food) {
41 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', [food], {isMethod: true}))); 43 let positionalArgs = [food];
44 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', positionalArgs, {isMethod: true})));
42 } 45 }
43 scratch(furniture) { 46 scratch(furniture) {
44 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , [furniture], {isMethod: true}))); 47 let positionalArgs = [furniture];
48 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , positionalArgs, {isMethod: true})));
45 } 49 }
46 }; 50 };
47 let const$; 51 let const$;
48 no_such_method_mock_test.MockCat3 = class MockCat3 extends no_such_method_mock _test.MockCat2 { 52 no_such_method_mock_test.MockCat3 = class MockCat3 extends no_such_method_mock _test.MockCat2 {
49 noSuchMethod(invocation) { 53 noSuchMethod(invocation) {
50 return dart.test(core.String.as(invocation.positionalArguments[dartx.get]( 0))[dartx.isNotEmpty]) && dart.test(dart.dsend(invocation.namedArguments[dartx.g et](const$ || (const$ = dart.const(core.Symbol.new('amount')))), '>', 0.5)); 54 return dart.test(core.String.as(invocation.positionalArguments[dartx.get]( 0))[dartx.isNotEmpty]) && dart.test(dart.dsend(invocation.namedArguments[dartx.g et](const$ || (const$ = dart.const(core.Symbol.new('amount')))), '>', 0.5));
51 } 55 }
52 eatFood(food, opts) { 56 eatFood(food, opts) {
53 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', [food], {namedArguments: opts, isMethod: true}))); 57 let positionalArgs = [food];
58 return core.bool._check(this.noSuchMethod(new dart.InvocationImpl('eatFood ', positionalArgs, {namedArguments: opts, isMethod: true})));
54 } 59 }
55 scratch(furniture, furniture2) { 60 scratch(furniture, furniture2) {
56 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , [furniture, furniture2], {isMethod: true}))); 61 let positionalArgs = [furniture];
62 for (let arg of [furniture2]) {
63 if (arg !== void 0) {
64 positionalArgs.push(arg);
65 }
66 }
67 return core.int._check(this.noSuchMethod(new dart.InvocationImpl('scratch' , positionalArgs, {isMethod: true})));
57 } 68 }
58 }; 69 };
59 no_such_method_mock_test.MockCat3[dart.implements] = () => [no_such_method_moc k_test.Cat]; 70 no_such_method_mock_test.MockCat3[dart.implements] = () => [no_such_method_moc k_test.Cat];
60 no_such_method_mock_test.MockWithGenerics = class MockWithGenerics extends cor e.Object { 71 no_such_method_mock_test.MockWithGenerics = class MockWithGenerics extends cor e.Object {
61 noSuchMethod(i) { 72 noSuchMethod(i) {
62 return dart.dsend(i.positionalArguments[dartx.get](0), '+', 100); 73 return dart.dsend(i.positionalArguments[dartx.get](0), '+', 100);
63 } 74 }
64 doStuff(T) { 75 doStuff(T) {
65 return t => { 76 return t => {
66 return T._check(this.noSuchMethod(new dart.InvocationImpl('doStuff', [t] , {isMethod: true}))); 77 let positionalArgs = [t];
78 return T._check(this.noSuchMethod(new dart.InvocationImpl('doStuff', pos itionalArgs, {isMethod: true})));
67 }; 79 };
68 } 80 }
69 }; 81 };
70 no_such_method_mock_test.main = function() { 82 no_such_method_mock_test.main = function() {
71 let mock = new no_such_method_mock_test.MockCat(); 83 let mock = new no_such_method_mock_test.MockCat();
72 expect$.Expect.isTrue(dart.dsend(mock, 'eatFood', "cat food")); 84 expect$.Expect.isTrue(dart.dsend(mock, 'eatFood', "cat food"));
73 expect$.Expect.isFalse(mock.eatFood("")); 85 expect$.Expect.isFalse(mock.eatFood(""));
74 expect$.Expect.throws(dart.fn(() => dart.notNull(mock.scratch("couch")) + 0, VoidToint())); 86 expect$.Expect.throws(dart.fn(() => dart.notNull(mock.scratch("couch")) + 0, VoidToint()));
75 let mock2 = new no_such_method_mock_test.MockCat2(); 87 let mock2 = new no_such_method_mock_test.MockCat2();
76 expect$.Expect.isTrue(mock2.eatFood("cat food")); 88 expect$.Expect.isTrue(mock2.eatFood("cat food"));
77 let mock3 = new no_such_method_mock_test.MockCat3(); 89 let mock3 = new no_such_method_mock_test.MockCat3();
78 expect$.Expect.isTrue(mock3.eatFood("cat food", {amount: 0.9})); 90 expect$.Expect.isTrue(mock3.eatFood("cat food", {amount: 0.9}));
79 expect$.Expect.isFalse(mock3.eatFood("cat food", {amount: 0.3})); 91 expect$.Expect.isFalse(mock3.eatFood("cat food", {amount: 0.3}));
80 let g = new no_such_method_mock_test.MockWithGenerics(); 92 let g = new no_such_method_mock_test.MockWithGenerics();
81 expect$.Expect.equals(g.doStuff(core.int)(42), 142); 93 expect$.Expect.equals(g.doStuff(core.int)(42), 142);
82 expect$.Expect.throws(dart.fn(() => g.doStuff(dart.dynamic)('hi'), VoidTovoi d())); 94 expect$.Expect.throws(dart.fn(() => g.doStuff(dart.dynamic)('hi'), VoidTovoi d()));
83 }; 95 };
84 dart.fn(no_such_method_mock_test.main, VoidTovoid()); 96 dart.fn(no_such_method_mock_test.main, VoidTovoid());
85 // Exports: 97 // Exports:
86 exports.no_such_method_mock_test = no_such_method_mock_test; 98 exports.no_such_method_mock_test = no_such_method_mock_test;
87 }); 99 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698