OLD | NEW |
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 "package:expect/expect.dart"; | |
6 | |
7 // Test that hidden native exception classes can be marked as existing. | 5 // Test that hidden native exception classes can be marked as existing. |
8 // | 6 // |
9 // To infer which native hidden types exist, we need | 7 // To infer which native hidden types exist, we need |
10 // (1) return types of native methods and getters | 8 // (1) return types of native methods and getters |
11 // (2) argument types of callbacks | 9 // (2) argument types of callbacks |
12 // (3) exceptions thrown by the operation. | 10 // (3) exceptions thrown by the operation. |
13 // | 11 // |
14 // (1) and (2) can be achieved by having nicely typed native methods, but there | 12 // (1) and (2) can be achieved by having nicely typed native methods, but there |
15 // is no place in the Dart language to communicate (3). So we use the following | 13 // is no place in the Dart language to communicate (3). So we use the following |
16 // fake body technique. | 14 // fake body technique. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 threw = false; | 90 threw = false; |
93 try { | 91 try { |
94 var x = aa.op(51); | 92 var x = aa.op(51); |
95 } on E catch (e) { | 93 } on E catch (e) { |
96 threw = true; | 94 threw = true; |
97 Expect.equals(100, e.code); | 95 Expect.equals(100, e.code); |
98 Expect.isTrue(e is E); | 96 Expect.isTrue(e is E); |
99 } | 97 } |
100 Expect.isTrue(threw); | 98 Expect.isTrue(threw); |
101 } | 99 } |
OLD | NEW |