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