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

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

Issue 10823423: Change dart2js_foreign suite to use metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
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 // Test that type checks occur on native methods. 5 // Test that type checks occur on native methods.
6 6
7 class A native "*A" { 7 @native("*A")
8 int foo(int x) native; 8 class A {
9 int cmp(A other) native; 9 @native int foo(int x);
10 @native int cmp(A other);
10 } 11 }
11 12
12 class B native "*B" { 13 @native("*B")
13 String foo(String x) native; 14 class B {
14 int cmp(B other) native; 15 @native String foo(String x);
16 @native int cmp(B other);
15 } 17 }
16 18
17 A makeA() native { return new A(); } 19 @native A makeA() { return new A(); }
18 B makeB() native { return new B(); } 20 @native B makeB() { return new B(); }
19 21
20 void setup() native """ 22 @native("""
21 function A() {} 23 function A() {}
22 A.prototype.foo = function (x) { return x + 1; }; 24 A.prototype.foo = function (x) { return x + 1; };
23 A.prototype.cmp = function (x) { return 0; }; 25 A.prototype.cmp = function (x) { return 0; };
24 26
25 function B() {} 27 function B() {}
26 B.prototype.foo = function (x) { return x + 'ha!'; }; 28 B.prototype.foo = function (x) { return x + 'ha!'; };
27 B.prototype.cmp = function (x) { return 1; }; 29 B.prototype.cmp = function (x) { return 1; };
28 30
29 makeA = function(){return new A;}; 31 makeA = function(){return new A;};
30 makeB = function(){return new B;}; 32 makeB = function(){return new B;};
31 """; 33 """)
34 void setup();
32 35
33 expectThrows(action()) { 36 expectThrows(action()) {
34 bool threw = false; 37 bool threw = false;
35 try { 38 try {
36 action(); 39 action();
37 } catch (var e) { 40 } catch (var e) {
38 threw = true; 41 threw = true;
39 } 42 }
40 Expect.isTrue(threw); 43 Expect.isTrue(threw);
41 } 44 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 132
130 main() { 133 main() {
131 setup(); 134 setup();
132 135
133 if (isCheckedMode()) { 136 if (isCheckedMode()) {
134 checkedModeTest(); 137 checkedModeTest();
135 } else { 138 } else {
136 uncheckedModeTest(); 139 uncheckedModeTest();
137 } 140 }
138 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698