OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.mixin; | 5 library test.mixin; |
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 class Super {} | 11 class Super {} |
| 12 |
12 class Mixin {} | 13 class Mixin {} |
| 14 |
13 class Mixin2 {} | 15 class Mixin2 {} |
14 | 16 |
15 class Class extends Super with Mixin {} | 17 class Class extends Super with Mixin {} |
| 18 |
16 class MultipleMixins extends Class with Mixin2 {} | 19 class MultipleMixins extends Class with Mixin2 {} |
17 | 20 |
18 main() { | 21 main() { |
| 22 Expect.equals(reflectClass(Class), reflectClass(Class).mixin); |
| 23 Expect.equals(reflectClass(Mixin), reflectClass(Class).superclass.mixin); |
| 24 Expect.equals( |
| 25 reflectClass(Super), reflectClass(Class).superclass.superclass.mixin); |
| 26 |
| 27 Expect.equals( |
| 28 reflectClass(MultipleMixins), reflectClass(MultipleMixins).mixin); |
| 29 Expect.equals( |
| 30 reflectClass(Mixin2), reflectClass(MultipleMixins).superclass.mixin); |
19 Expect.equals(reflectClass(Class), | 31 Expect.equals(reflectClass(Class), |
20 reflectClass(Class).mixin); | 32 reflectClass(MultipleMixins).superclass.superclass.mixin); |
21 Expect.equals(reflectClass(Mixin), | 33 Expect.equals(reflectClass(Mixin), |
22 reflectClass(Class).superclass.mixin); | 34 reflectClass(MultipleMixins).superclass.superclass.superclass.mixin); |
23 Expect.equals(reflectClass(Super), | 35 Expect.equals( |
24 reflectClass(Class).superclass.superclass.mixin); | 36 reflectClass(Super), |
25 | 37 reflectClass(MultipleMixins) |
26 Expect.equals(reflectClass(MultipleMixins), | 38 .superclass |
27 reflectClass(MultipleMixins).mixin); | 39 .superclass |
28 Expect.equals(reflectClass(Mixin2), | 40 .superclass |
29 reflectClass(MultipleMixins).superclass.mixin); | 41 .superclass |
30 Expect.equals(reflectClass(Class), | 42 .mixin); |
31 reflectClass(MultipleMixins).superclass.superclass.mixin); | |
32 Expect.equals(reflectClass(Mixin), | |
33 reflectClass(MultipleMixins).superclass.superclass.superclass | |
34 .mixin); | |
35 Expect.equals(reflectClass(Super), | |
36 reflectClass(MultipleMixins).superclass.superclass.superclass | |
37 .superclass.mixin); | |
38 } | 43 } |
OLD | NEW |