| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library test.reflect_model_test; | 5 library test.reflect_model_test; |
| 6 | 6 |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 | 8 |
| 9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
| 10 | 10 |
| 11 import 'model.dart'; | 11 import 'model.dart'; |
| 12 | 12 |
| 13 isNoSuchMethodError(e) => e is NoSuchMethodError; | 13 isNoSuchMethodError(e) => e is NoSuchMethodError; |
| 14 | 14 |
| 15 name(Declaration mirror) { | 15 name(DeclarationMirror mirror) { |
| 16 return (mirror == null) ? '<null>' : stringify(mirror.simpleName); | 16 return (mirror == null) ? '<null>' : stringify(mirror.simpleName); |
| 17 } | 17 } |
| 18 | 18 |
| 19 stringifyMap(Map map) { | 19 stringifyMap(Map map) { |
| 20 var buffer = new StringBuffer('{'); | 20 var buffer = new StringBuffer('{'); |
| 21 bool first = true; | 21 bool first = true; |
| 22 for (String key in map.keys.map(MirrorSystem.getName).toList()..sort()) { | 22 for (String key in map.keys.map(MirrorSystem.getName).toList()..sort()) { |
| 23 if (!first) buffer.write(', '); | 23 if (!first) buffer.write(', '); |
| 24 first = false; | 24 first = false; |
| 25 buffer.write(key); | 25 buffer.write(key); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee); | 160 Expect.equals('aMethod', c.invoke(aMethod, []).reflectee); |
| 161 | 161 |
| 162 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError); | 162 Expect.throws(() { a.invoke(bMethod, []); }, isNoSuchMethodError); |
| 163 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee); | 163 Expect.equals('bMethod', b.invoke(bMethod, []).reflectee); |
| 164 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee); | 164 Expect.equals('bMethod', c.invoke(bMethod, []).reflectee); |
| 165 | 165 |
| 166 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError); | 166 Expect.throws(() { a.invoke(cMethod, []); }, isNoSuchMethodError); |
| 167 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError); | 167 Expect.throws(() { b.invoke(cMethod, []); }, isNoSuchMethodError); |
| 168 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee); | 168 Expect.equals('cMethod', c.invoke(cMethod, []).reflectee); |
| 169 } | 169 } |
| OLD | NEW |