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

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

Issue 10891020: Update almost all tests (except co19) to use the new try-catch syntax. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge. Created 8 years, 3 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 @native("*A") 7 @native("*A")
8 class A { 8 class A {
9 @native int foo(int x); 9 @native int foo(int x);
10 @native int cmp(A other); 10 @native int cmp(A other);
(...skipping 19 matching lines...) Expand all
30 30
31 makeA = function(){return new A;}; 31 makeA = function(){return new A;};
32 makeB = function(){return new B;}; 32 makeB = function(){return new B;};
33 """) 33 """)
34 void setup(); 34 void setup();
35 35
36 expectThrows(action()) { 36 expectThrows(action()) {
37 bool threw = false; 37 bool threw = false;
38 try { 38 try {
39 action(); 39 action();
40 } catch (var e) { 40 } catch (e) {
41 threw = true; 41 threw = true;
42 } 42 }
43 Expect.isTrue(threw); 43 Expect.isTrue(threw);
44 } 44 }
45 45
46 checkedModeTest() { 46 checkedModeTest() {
47 var things = [makeA(), makeB()]; 47 var things = [makeA(), makeB()];
48 var a = things[0]; 48 var a = things[0];
49 var b = things[1]; 49 var b = things[1];
50 50
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 Expect.equals(1, bb.cmp(5)); 119 Expect.equals(1, bb.cmp(5));
120 } 120 }
121 121
122 bool isCheckedMode() { 122 bool isCheckedMode() {
123 var stuff = [1, 'string']; 123 var stuff = [1, 'string'];
124 var a = stuff[0]; 124 var a = stuff[0];
125 // Checked-mode detection. 125 // Checked-mode detection.
126 try { 126 try {
127 String s = a; 127 String s = a;
128 return false; 128 return false;
129 } catch (var e) { } 129 } catch (e) {
130 // Ignore.
131 }
130 return true; 132 return true;
131 } 133 }
132 134
133 main() { 135 main() {
134 setup(); 136 setup();
135 137
136 if (isCheckedMode()) { 138 if (isCheckedMode()) {
137 checkedModeTest(); 139 checkedModeTest();
138 } else { 140 } else {
139 uncheckedModeTest(); 141 uncheckedModeTest();
140 } 142 }
141 } 143 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_extra/naming_test.dart ('k') | tests/compiler/dart2js_foreign/native_checked_fields_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698