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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 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 // 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 type checks occur on native methods. 7 // Test that type checks occur on native methods.
8 8
9 @Native("A") 9 @Native("A")
10 class A { 10 class A {
11 int foo(int x) native; 11 int foo(int x) native;
12 int cmp(A other) native; 12 int cmp(A other) native;
13 } 13 }
14 14
15 @Native("B") 15 @Native("B")
16 class B { 16 class B {
17 String foo(String x) native; 17 String foo(String x) native;
18 int cmp(B other) native; 18 int cmp(B other) native;
19 } 19 }
20 20
21 A makeA() native; 21 A makeA() native;
22 B makeB() native; 22 B makeB() native;
23 23
24 void setup() native """ 24 void setup() {
25 function A() {} 25 JS('', r"""
26 A.prototype.foo = function (x) { return x + 1; }; 26 (function(){
27 A.prototype.cmp = function (x) { return 0; }; 27 function A() {}
28 A.prototype.foo = function (x) { return x + 1; };
29 A.prototype.cmp = function (x) { return 0; };
28 30
29 function B() {} 31 function B() {}
30 B.prototype.foo = function (x) { return x + 'ha!'; }; 32 B.prototype.foo = function (x) { return x + 'ha!'; };
31 B.prototype.cmp = function (x) { return 1; }; 33 B.prototype.cmp = function (x) { return 1; };
32 34
33 makeA = function(){return new A;}; 35 makeA = function(){return new A()};
34 makeB = function(){return new B;}; 36 makeB = function(){return new B()};
35 37
36 self.nativeConstructor(A); 38 self.nativeConstructor(A);
37 self.nativeConstructor(B); 39 self.nativeConstructor(B);
38 """; 40 })()""");
41 }
39 42
40 expectThrows(action()) { 43 expectThrows(action()) {
41 bool threw = false; 44 bool threw = false;
42 try { 45 try {
43 action(); 46 action();
44 } catch (e) { 47 } catch (e) {
45 threw = true; 48 threw = true;
46 } 49 }
47 Expect.isTrue(threw); 50 Expect.isTrue(threw);
48 } 51 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 main() { 142 main() {
140 nativeTesting(); 143 nativeTesting();
141 setup(); 144 setup();
142 145
143 if (isCheckedMode()) { 146 if (isCheckedMode()) {
144 checkedModeTest(); 147 checkedModeTest();
145 } else { 148 } else {
146 uncheckedModeTest(); 149 uncheckedModeTest();
147 } 150 }
148 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698