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(reflectClass(FunctionFoo).isAbstract); | |
42 Expect.isFalse(reflectClass(FunctionBar).isAbstract); | |
43 Expect.isTrue(reflect(new FunctionBar()).type.superclass.isAbstract); | |
44 Expect.isFalse(reflect(new FunctionBar()).type.isAbstract); | |
gbracha
2014/01/08 21:33:24
Why is there no analog for this with Bar? viz.
Ex
rmacnak
2014/01/08 21:53:56
Added. The important thing is really to test with
| |
45 | |
46 // Bound ClassMirror | |
47 Expect.isTrue(reflect(new GenericBar<int>()).type.superclass.isAbstract); | |
48 Expect.isFalse(reflect(new GenericBar<int>()).type.isAbstract); | |
49 } | |
OLD | NEW |