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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_call_arity3_test.dart

Issue 11293272: Update dart2js_foreign suite as we now validate annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
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 // Test similar to NativeCallArity1FrogTest, but with default values to 5 // Test similar to NativeCallArity1FrogTest, but with default values to
6 // parameters set to null. These parameters should be treated as if they 6 // parameters set to null. These parameters should be treated as if they
7 // do not have a default value for the native methods. 7 // do not have a default value for the native methods.
8 8
9 @native("*A") 9 import 'native_metadata.dart';
10
11 @Native("*A")
10 class A { 12 class A {
11 @native int foo(int x); 13 @native int foo(int x);
12 } 14 }
13 15
14 @native("*B") 16 @Native("*B")
15 class B { 17 class B {
16 @native int foo([x = null, y, z = null]); 18 @native int foo([x = null, y, z = null]);
17 } 19 }
18 20
19 // TODO(sra): Add a case where the parameters have default values. Wait until 21 // TODO(sra): Add a case where the parameters have default values. Wait until
20 // dart:html need non-null default values. 22 // dart:html need non-null default values.
21 23
22 @native A makeA() { return new A(); } 24 @native A makeA() { return new A(); }
23 @native B makeB() { return new B(); } 25 @native B makeB() { return new B(); }
24 26
25 @native(""" 27 @Native("""
26 function A() {} 28 function A() {}
27 A.prototype.foo = function () { return arguments.length; }; 29 A.prototype.foo = function () { return arguments.length; };
28 30
29 function B() {} 31 function B() {}
30 B.prototype.foo = function () { return arguments.length; }; 32 B.prototype.foo = function () { return arguments.length; };
31 33
32 makeA = function(){return new A;}; 34 makeA = function(){return new A;};
33 makeB = function(){return new B;}; 35 makeB = function(){return new B;};
34 """) 36 """)
35 void setup(); 37 void setup();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Expect.equals(2, b.foo(y: 20)); 76 Expect.equals(2, b.foo(y: 20));
75 Expect.equals(3, b.foo(z: 30)); 77 Expect.equals(3, b.foo(z: 30));
76 Expect.throws(() => b.foo(10, 20, 30, 40)); 78 Expect.throws(() => b.foo(10, 20, 30, 40));
77 } 79 }
78 80
79 main() { 81 main() {
80 setup(); 82 setup();
81 testDynamicContext(); 83 testDynamicContext();
82 testStaticContext(); 84 testStaticContext();
83 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698