Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: tests/lib/mirrors/relation_subclass_test.dart

Issue 2617743002: Add mirrors tests for Null type. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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.relation_subclass; 5 library test.relation_subclass;
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
(...skipping 10 matching lines...) Expand all
21 typedef double DoubleGenerator(); 21 typedef double DoubleGenerator();
22 22
23 test(MirrorSystem mirrors) { 23 test(MirrorSystem mirrors) {
24 LibraryMirror coreLibrary = mirrors.findLibrary(#dart.core); 24 LibraryMirror coreLibrary = mirrors.findLibrary(#dart.core);
25 LibraryMirror thisLibrary = mirrors.findLibrary(#test.relation_subclass); 25 LibraryMirror thisLibrary = mirrors.findLibrary(#test.relation_subclass);
26 26
27 ClassMirror Super = thisLibrary.declarations[#Superclass]; 27 ClassMirror Super = thisLibrary.declarations[#Superclass];
28 ClassMirror Sub1 = thisLibrary.declarations[#Subclass1]; 28 ClassMirror Sub1 = thisLibrary.declarations[#Subclass1];
29 ClassMirror Sub2 = thisLibrary.declarations[#Subclass2]; 29 ClassMirror Sub2 = thisLibrary.declarations[#Subclass2];
30 ClassMirror Obj = coreLibrary.declarations[#Object]; 30 ClassMirror Obj = coreLibrary.declarations[#Object];
31 ClassMirror Nul = coreLibrary.declarations[#Null];
31 32
32 Expect.isTrue(Obj.isSubclassOf(Obj)); 33 Expect.isTrue(Obj.isSubclassOf(Obj));
33 Expect.isTrue(Super.isSubclassOf(Super)); 34 Expect.isTrue(Super.isSubclassOf(Super));
34 Expect.isTrue(Sub1.isSubclassOf(Sub1)); 35 Expect.isTrue(Sub1.isSubclassOf(Sub1));
35 Expect.isTrue(Sub2.isSubclassOf(Sub2)); 36 Expect.isTrue(Sub2.isSubclassOf(Sub2));
37 Expect.isTrue(Nul.isSubclassOf(Nul));
36 38
37 Expect.isTrue(Sub1.isSubclassOf(Super)); 39 Expect.isTrue(Sub1.isSubclassOf(Super));
38 Expect.isFalse(Super.isSubclassOf(Sub1)); 40 Expect.isFalse(Super.isSubclassOf(Sub1));
39 41
40 Expect.isTrue(Sub2.isSubclassOf(Super)); 42 Expect.isTrue(Sub2.isSubclassOf(Super));
41 Expect.isFalse(Super.isSubclassOf(Sub2)); 43 Expect.isFalse(Super.isSubclassOf(Sub2));
42 44
43 Expect.isFalse(Sub2.isSubclassOf(Sub1)); 45 Expect.isFalse(Sub2.isSubclassOf(Sub1));
44 Expect.isFalse(Sub1.isSubclassOf(Sub2)); 46 Expect.isFalse(Sub1.isSubclassOf(Sub2));
45 47
46 Expect.isTrue(Sub1.isSubclassOf(Obj)); 48 Expect.isTrue(Sub1.isSubclassOf(Obj));
47 Expect.isFalse(Obj.isSubclassOf(Sub1)); 49 Expect.isFalse(Obj.isSubclassOf(Sub1));
48 50
49 Expect.isTrue(Sub2.isSubclassOf(Obj)); 51 Expect.isTrue(Sub2.isSubclassOf(Obj));
50 Expect.isFalse(Obj.isSubclassOf(Sub2)); 52 Expect.isFalse(Obj.isSubclassOf(Sub2));
51 53
52 Expect.isTrue(Super.isSubclassOf(Obj)); 54 Expect.isTrue(Super.isSubclassOf(Obj));
53 Expect.isFalse(Obj.isSubclassOf(Super)); 55 Expect.isFalse(Obj.isSubclassOf(Super));
54 56
57 Expect.isTrue(Nul.isSubclassOf(Obj));
58 Expect.isFalse(Obj.isSubclassOf(Nul));
59 Expect.isFalse(Nul.isSubclassOf(Super));
60 Expect.isFalse(Super.isSubclassOf(Nul));
61
55 var Func = coreLibrary.declarations[#Function]; 62 var Func = coreLibrary.declarations[#Function];
56 Expect.isTrue(Func.isSubclassOf(Obj)); 63 Expect.isTrue(Func.isSubclassOf(Obj));
57 Expect.isFalse(Obj.isSubclassOf(Func)); 64 Expect.isFalse(Obj.isSubclassOf(Func));
58 65
59 // Function typedef. 66 // Function typedef.
60 var NumPred = thisLibrary.declarations[#NumberPredicate]; 67 var NumPred = thisLibrary.declarations[#NumberPredicate];
61 var IntPred = thisLibrary.declarations[#IntegerPredicate]; 68 var IntPred = thisLibrary.declarations[#IntegerPredicate];
62 var DubPred = thisLibrary.declarations[#DoublePredicate]; 69 var DubPred = thisLibrary.declarations[#DoublePredicate];
63 var NumGen = thisLibrary.declarations[#NumberGenerator]; 70 var NumGen = thisLibrary.declarations[#NumberGenerator];
64 var IntGen = thisLibrary.declarations[#IntegerGenerator]; 71 var IntGen = thisLibrary.declarations[#IntegerGenerator];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // IntPredRef.isSubclassOf(Func); 108 // IntPredRef.isSubclassOf(Func);
102 // DubPredRef.isSubclassOf(Func); 109 // DubPredRef.isSubclassOf(Func);
103 // NumGenRef.isSubclassOf(Func); 110 // NumGenRef.isSubclassOf(Func);
104 // IntGenRef.isSubclassOf(Func); 111 // IntGenRef.isSubclassOf(Func);
105 // DubGenRef.isSubclassOf(Func); 112 // DubGenRef.isSubclassOf(Func);
106 } 113 }
107 114
108 main() { 115 main() {
109 test(currentMirrorSystem()); 116 test(currentMirrorSystem());
110 } 117 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/relation_assignable_test.dart ('k') | tests/lib/mirrors/relation_subtype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698