OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 library test.abstract_class_test; | |
6 | |
7 import 'dart:mirrors'; | |
8 import 'package:expect/expect.dart'; | |
9 | |
10 abstract class Foo { | |
11 foo(); | |
12 } | |
13 class Bar extends Foo { | |
14 foo() {} | |
15 } | |
16 | |
17 abstract class FunctionFoo implements Function { | |
18 call(); | |
19 } | |
20 class FunctionBar extends FunctionFoo { | |
21 call() {} | |
22 } | |
23 | |
24 abstract class GenericFoo<T> { | |
25 T genericFoo(); | |
26 } | |
27 class GenericBar<T> extends GenericFoo<T> { | |
28 T genericFoo() {} | |
29 } | |
30 | |
31 void main() { | |
32 // FunctionTypeMirror | |
33 baz() {} | |
34 Expect.isFalse(reflect(baz).type.isAbstract); | |
35 | |
36 return; /// 01: ok | |
37 | |
38 // Unbound ClassMirror | |
39 Expect.isTrue(reflectClass(Foo).isAbstract); | |
40 Expect.isFalse(reflectClass(Bar).isAbstract); | |
41 Expect.isTrue(reflect(new Bar()).type.superclass.isAbstract); | |
42 Expect.isFalse(reflect(new Bar()).type.isAbstract); | |
43 | |
44 Expect.isTrue(reflectClass(FunctionFoo).isAbstract); | |
45 Expect.isFalse(reflectClass(FunctionBar).isAbstract); | |
46 Expect.isTrue(reflect(new FunctionBar()).type.superclass.isAbstract); | |
47 Expect.isFalse(reflect(new FunctionBar()).type.isAbstract); | |
48 | |
49 Expect.isTrue(reflectClass(GenericFoo).isAbstract); | |
50 Expect.isFalse(reflectClass(GenericBar).isAbstract); | |
51 | |
52 // Bound ClassMirror | |
53 Expect.isTrue(reflect(new GenericBar<int>()).type.superclass.isAbstract); | |
54 Expect.isFalse(reflect(new GenericBar<int>()).type.isAbstract); | |
55 } | |
OLD | NEW |