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

Side by Side Diff: tests/compiler/dart2js_native/native_checked_fields_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 assignment to fields of native methods. 7 // Test that type checks occur on assignment to fields of native methods.
8 8
9 @Native("A") 9 @Native("A")
10 class A { 10 class A {
11 int foo; 11 int foo;
12 } 12 }
13 13
14 @Native("B") 14 @Native("B")
15 class B { 15 class B {
16 String foo; 16 String foo;
17 } 17 }
18 18
19 A makeA() native; 19 A makeA() native;
20 B makeB() native; 20 B makeB() native;
21 21
22 void setup() native """ 22 void setup() {
23 function A() {} 23 JS('', r"""
24 (function(){
25 function A() {}
24 26
25 function B() {} 27 function B() {}
26 28
27 makeA = function(){return new A;}; 29 makeA = function(){return new A()};
28 makeB = function(){return new B;}; 30 makeB = function(){return new B()};
29 31
30 self.nativeConstructor(A); 32 self.nativeConstructor(A);
31 self.nativeConstructor(B); 33 self.nativeConstructor(B);
32 """; 34 })()""");
35 }
33 36
34 expectThrows(action()) { 37 expectThrows(action()) {
35 bool threw = false; 38 bool threw = false;
36 try { 39 try {
37 action(); 40 action();
38 } catch (e) { 41 } catch (e) {
39 threw = true; 42 threw = true;
40 } 43 }
41 Expect.isTrue(threw); 44 Expect.isTrue(threw);
42 } 45 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 main() { 116 main() {
114 nativeTesting(); 117 nativeTesting();
115 setup(); 118 setup();
116 119
117 if (isCheckedMode()) { 120 if (isCheckedMode()) {
118 checkedModeTest(); 121 checkedModeTest();
119 } else { 122 } else {
120 uncheckedModeTest(); 123 uncheckedModeTest();
121 } 124 }
122 } 125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698