OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 |
5 // InvocationMirror and noSuchMethod testing. | 7 // InvocationMirror and noSuchMethod testing. |
6 | 8 |
7 /** Class with noSuchMethod that returns the mirror */ | 9 /** Class with noSuchMethod that returns the mirror */ |
8 class N { | 10 class N { |
9 // Storage for the last argument to noSuchMethod. | 11 // Storage for the last argument to noSuchMethod. |
10 // Needed for setters, which don't evaluate to the return value. | 12 // Needed for setters, which don't evaluate to the return value. |
11 var last; | 13 var last; |
12 noSuchMethod(InvocationMirror m) => last = m; | 14 noSuchMethod(InvocationMirror m) => last = m; |
13 | 15 |
14 flif(int x) { Expect.fail("never get here"); } | 16 flif(int x) { Expect.fail("never get here"); } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 test(() => o.hashCode = 42); | 237 test(() => o.hashCode = 42); |
236 test(() => o.hashCode()); // Thrown by int.noSuchMethod. | 238 test(() => o.hashCode()); // Thrown by int.noSuchMethod. |
237 test(() => (n.flif)()); // Extracted method has no noSuchMethod. | 239 test(() => (n.flif)()); // Extracted method has no noSuchMethod. |
238 } | 240 } |
239 | 241 |
240 main() { | 242 main() { |
241 testInvocationMirrors(); | 243 testInvocationMirrors(); |
242 testNoSuchMethodErrors(); | 244 testNoSuchMethodErrors(); |
243 new M().testSuperCalls(); | 245 new M().testSuperCalls(); |
244 } | 246 } |
OLD | NEW |