| 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 // Ensure that objects handled specially by dart2js can be reflected on. | 5 // Ensure that objects handled specially by dart2js can be reflected on. |
| 6 | 6 |
| 7 library test.intercepted_object_test; | 7 library test.intercepted_object_test; |
| 8 | 8 |
| 9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
| 10 | 10 |
| 11 import 'stringify.dart' show stringify, expect; | 11 import 'stringify.dart' show stringify, expect; |
| 12 | 12 |
| 13 import 'intercepted_class_test.dart' show checkClassMirror; | 13 import 'intercepted_class_test.dart' show checkClassMirrorMethods; |
| 14 | 14 |
| 15 checkObject(object, String name) { | 15 checkImplements(object, String name) { |
| 16 checkClassMirror(reflect(object).type, name); | 16 ClassMirror cls = reflect(object).type; |
| 17 checkClassMirrorMethods(cls); |
| 18 |
| 19 List<ClassMirror> superinterfaces = cls.superinterfaces; |
| 20 String symName = 's($name)'; |
| 21 for (ClassMirror superinterface in superinterfaces) { |
| 22 print(superinterface.simpleName); |
| 23 if (symName == stringify(superinterface.simpleName)) { |
| 24 checkClassMirrorMethods(superinterface); |
| 25 return; |
| 26 } |
| 27 } |
| 28 |
| 29 // TODO(floitsch): use correct fail |
| 30 expect(name, "super interface not found"); |
| 17 } | 31 } |
| 18 | 32 |
| 19 main() { | 33 main() { |
| 20 checkObject('', 'String'); | 34 checkImplements('', 'String'); |
| 21 checkObject(1, 'int'); | 35 checkImplements(1, 'int'); |
| 22 checkObject(1.5, 'double'); | 36 checkImplements(1.5, 'double'); |
| 23 checkObject(true, 'bool'); | 37 checkImplements(true, 'bool'); |
| 24 checkObject(false, 'bool'); | 38 checkImplements(false, 'bool'); |
| 25 checkObject([], 'List'); | 39 checkImplements([], 'List'); |
| 26 } | 40 } |
| OLD | NEW |