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

Side by Side Diff: tests/compiler/dart2js_native/native_exceptions1_frog_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 hidden native exception classes can be marked as existing. 5 // Test that hidden native exception classes can be marked as existing.
6 // 6 //
7 // To infer which native hidden types exist, we need 7 // To infer which native hidden types exist, we need
8 // (1) return types of native methods and getters 8 // (1) return types of native methods and getters
9 // (2) argument types of callbacks 9 // (2) argument types of callbacks
10 // (3) exceptions thrown by the operation. 10 // (3) exceptions thrown by the operation.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 var a = things[inscrutable(0)]; 65 var a = things[inscrutable(0)];
66 var b = things[inscrutable(1)]; 66 var b = things[inscrutable(1)];
67 67
68 Expect.equals(25, a.op(50)); 68 Expect.equals(25, a.op(50));
69 Expect.equals(123, b.op('hello')); 69 Expect.equals(123, b.op('hello'));
70 Expect.equals(666, b.code); 70 Expect.equals(666, b.code);
71 71
72 bool threw = false; 72 bool threw = false;
73 try { 73 try {
74 var x = a.op(51); 74 var x = a.op(51);
75 } catch (var e) { 75 } catch (e) {
76 threw = true; 76 threw = true;
77 Expect.equals(100, e.code); 77 Expect.equals(100, e.code);
78 Expect.isTrue(e is E); 78 Expect.isTrue(e is E);
79 } 79 }
80 Expect.isTrue(threw); 80 Expect.isTrue(threw);
81 81
82 // Again, but with statically typed receivers. 82 // Again, but with statically typed receivers.
83 A aa = a; 83 A aa = a;
84 B bb = b; 84 B bb = b;
85 85
86 Expect.equals(25, aa.op(50)); 86 Expect.equals(25, aa.op(50));
87 Expect.equals(123, bb.op('hello')); 87 Expect.equals(123, bb.op('hello'));
88 Expect.equals(666, bb.code); 88 Expect.equals(666, bb.code);
89 89
90 threw = false; 90 threw = false;
91 try { 91 try {
92 var x = aa.op(51); 92 var x = aa.op(51);
93 } catch (E e) { 93 } on E catch (e) {
94 threw = true; 94 threw = true;
95 Expect.equals(100, e.code); 95 Expect.equals(100, e.code);
96 Expect.isTrue(e is E); 96 Expect.isTrue(e is E);
97 } 97 }
98 Expect.isTrue(threw); 98 Expect.isTrue(threw);
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698