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

Side by Side Diff: tests/compiler/dart2js_native/native_wrapping_function3_frog_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "native_testing.dart"; 5 import "native_testing.dart";
6 6
7 typedef void Callback0(); 7 typedef void Callback0();
8 typedef void Callback1(arg1); 8 typedef void Callback1(arg1);
9 typedef void Callback2(arg1, arg2); 9 typedef void Callback2(arg1, arg2);
10 10
11 @Native("A") 11 @Native("A")
12 class A { 12 class A {
13 foo1(Callback1 closure, [arg1 = 0]) native ; 13 foo1(Callback1 closure, [arg1 = 0]) native;
14 foo2(Callback2 closure, [arg1 = 0, arg2 = 1]) native ; 14 foo2(Callback2 closure, [arg1 = 0, arg2 = 1]) native;
15 } 15 }
16 16
17 A makeA() native ; 17 A makeA() native;
18 18
19 void setup() native """ 19 void setup() native """
20 function A() {} 20 function A() {}
21 A.prototype.foo1 = function(closure, arg1) { return closure(arg1); }; 21 A.prototype.foo1 = function(closure, arg1) { return closure(arg1); };
22 A.prototype.foo2 = function(closure, arg1, arg2) { 22 A.prototype.foo2 = function(closure, arg1, arg2) {
23 return closure(arg1, arg2); 23 return closure(arg1, arg2);
24 }; 24 };
25 makeA = function(){return new A;}; 25 makeA = function(){return new A;};
26 self.nativeConstructor(A); 26 self.nativeConstructor(A);
27 """; 27 """;
28 28
29 main() { 29 main() {
30 nativeTesting(); 30 nativeTesting();
31 setup(); 31 setup();
32 var a = makeA(); 32 var a = makeA();
33 // Statically known receiver type calls. 33 // Statically known receiver type calls.
34 Expect.equals(43, a.foo1((arg1) => arg1, 43)); 34 Expect.equals(43, a.foo1((arg1) => arg1, 43));
35 Expect.equals(0, a.foo1((arg1) => arg1)); 35 Expect.equals(0, a.foo1((arg1) => arg1));
36 36
37 Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, 21, 23)); 37 Expect.equals(44, a.foo2((arg1, arg2) => arg1 + arg2, 21, 23));
38 Expect.equals(22, a.foo2((arg1, arg2) => arg1 + arg2, 21)); 38 Expect.equals(22, a.foo2((arg1, arg2) => arg1 + arg2, 21));
39 39
40 // Dynamic calls. 40 // Dynamic calls.
41 Expect.equals(43, confuse(a).foo1((arg1) => arg1, 43)); 41 Expect.equals(43, confuse(a).foo1((arg1) => arg1, 43));
42 Expect.equals(0, confuse(a).foo1((arg1) => arg1)); 42 Expect.equals(0, confuse(a).foo1((arg1) => arg1));
43 43
44 Expect.equals(44, confuse(a).foo2((arg1, arg2) => arg1 + arg2, 21, 23)); 44 Expect.equals(44, confuse(a).foo2((arg1, arg2) => arg1 + arg2, 21, 23));
45 Expect.equals(22, confuse(a).foo2((arg1, arg2) => arg1 + arg2, 21)); 45 Expect.equals(22, confuse(a).foo2((arg1, arg2) => arg1 + arg2, 21));
46 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698