| 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.constructors_test; | 5 library test.constructors_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 'stringify.dart'; | 11 import 'stringify.dart'; |
| 12 | 12 |
| 13 class Foo { | 13 class Foo { |
| 14 } | 14 } |
| 15 | 15 |
| 16 class Bar { | 16 class Bar { |
| 17 Bar(); | 17 Bar(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 class Baz { | 20 class Baz { |
| 21 Baz.named(); | 21 Baz.named(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 class Biz { | 24 class Biz { |
| 25 Biz(); | 25 Biz(); |
| 26 Biz.named(); | 26 Biz.named(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 main() { | 29 main() { |
| 30 MirrorSystem mirrors = currentMirrorSystem(); | |
| 31 ClassMirror fooMirror = reflectClass(Foo); | 30 ClassMirror fooMirror = reflectClass(Foo); |
| 32 Map<Symbol, MethodMirror> fooConstructors = fooMirror.constructors; | 31 Map<Symbol, MethodMirror> fooConstructors = fooMirror.constructors; |
| 33 ClassMirror barMirror = reflectClass(Bar); | 32 ClassMirror barMirror = reflectClass(Bar); |
| 34 Map<Symbol, MethodMirror> barConstructors = barMirror.constructors; | 33 Map<Symbol, MethodMirror> barConstructors = barMirror.constructors; |
| 35 ClassMirror bazMirror = reflectClass(Baz); | 34 ClassMirror bazMirror = reflectClass(Baz); |
| 36 Map<Symbol, MethodMirror> bazConstructors = bazMirror.constructors; | 35 Map<Symbol, MethodMirror> bazConstructors = bazMirror.constructors; |
| 37 ClassMirror bizMirror = reflectClass(Biz); | 36 ClassMirror bizMirror = reflectClass(Biz); |
| 38 Map<Symbol, MethodMirror> bizConstructors = bizMirror.constructors; | 37 Map<Symbol, MethodMirror> bizConstructors = bizMirror.constructors; |
| 39 | 38 |
| 40 expect('{Foo: Method(s(Foo) in s(Foo), constructor)}', fooConstructors); | 39 expect('{Foo: Method(s(Foo) in s(Foo), constructor)}', fooConstructors); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 expect('[s()]', | 55 expect('[s()]', |
| 57 fooConstructors.values.map((m) => m.constructorName).toList()); | 56 fooConstructors.values.map((m) => m.constructorName).toList()); |
| 58 expect('[s()]', | 57 expect('[s()]', |
| 59 barConstructors.values.map((m) => m.constructorName).toList()); | 58 barConstructors.values.map((m) => m.constructorName).toList()); |
| 60 expect('[s(named)]', | 59 expect('[s(named)]', |
| 61 bazConstructors.values.map((m) => m.constructorName).toList()); | 60 bazConstructors.values.map((m) => m.constructorName).toList()); |
| 62 expect('[s(), s(named)]', | 61 expect('[s(), s(named)]', |
| 63 bizConstructors.values.map((m) => m.constructorName).toList() | 62 bizConstructors.values.map((m) => m.constructorName).toList() |
| 64 ..sort(compareSymbols)); | 63 ..sort(compareSymbols)); |
| 65 } | 64 } |
| OLD | NEW |