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

Side by Side Diff: tests/compiler/dart2js_native/native_call_arity1_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Test that native methods with unnamed* optional arguments are called with the 7 // Test that native methods with unnamed* optional arguments are called with the
8 // number of arguments in the call site. This is necessary because native 8 // number of arguments in the call site. This is necessary because native
9 // methods can dispatch on the number of arguments. Passing null or undefined 9 // methods can dispatch on the number of arguments. Passing null or undefined
10 // as the last argument is not the same as passing one fewer argument. 10 // as the last argument is not the same as passing one fewer argument.
11 // 11 //
12 // * Optional positional arguments are passed in the correct position, so 12 // * Optional positional arguments are passed in the correct position, so
13 // require preceding arguments to be passed. 13 // require preceding arguments to be passed.
14 14
15 @Native("A") 15 @Native("A")
16 class A { 16 class A {
17 int foo(int x) native ; 17 int foo(int x) native;
18 } 18 }
19 19
20 @Native("B") 20 @Native("B")
21 class B { 21 class B {
22 int foo([x, y, z]) native ; 22 int foo([x, y, z]) native;
23 } 23 }
24 24
25 // TODO(sra): Add a case where the parameters have default values. Wait until 25 // TODO(sra): Add a case where the parameters have default values. Wait until
26 // dart:html need non-null default values. 26 // dart:html need non-null default values.
27 27
28 A makeA() native ; 28 A makeA() native;
29 B makeB() native ; 29 B makeB() native;
30 30
31 void setup() native """ 31 void setup() native """
32 function A() {} 32 function A() {}
33 A.prototype.foo = function () { return arguments.length; }; 33 A.prototype.foo = function () { return arguments.length; };
34 34
35 function B() {} 35 function B() {}
36 B.prototype.foo = function () { return arguments.length; }; 36 B.prototype.foo = function () { return arguments.length; };
37 37
38 makeA = function(){return new A;}; 38 makeA = function(){return new A;};
39 makeB = function(){return new B;}; 39 makeB = function(){return new B;};
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 Expect.throws(() => b.foo(10, 20, 30, 40)); 76 Expect.throws(() => b.foo(10, 20, 30, 40));
77 } 77 }
78 78
79 main() { 79 main() {
80 nativeTesting(); 80 nativeTesting();
81 setup(); 81 setup();
82 testDynamicContext(); 82 testDynamicContext();
83 testStaticContext(); 83 testStaticContext();
84 } 84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698