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

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

Issue 95123002: Substitute type variables as type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
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 // This tests uses the multi-test "ok" feature: 5 // This tests uses the multi-test "ok" feature:
6 // none: Trimmed behaviour. Passing on the VM. 6 // none: Trimmed behaviour. Passing on the VM.
7 // 01: Trimmed version for dart2js. 7 // 01: Trimmed version for dart2js.
8 // 02: Full version passing in the VM. 8 // 02: Full version passing in the VM.
9 // 9 //
10 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par. 10 // TODO(rmacnak,ahe): Remove multi-test when VM and dart2js are on par.
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 typedef bool Predicate(Object o); 27 typedef bool Predicate(Object o);
28 Predicate somePredicate; 28 Predicate somePredicate;
29 29
30 checkEquality(List<Map> equivalenceClasses) { 30 checkEquality(List<Map> equivalenceClasses) {
31 for (var equivalenceClass in equivalenceClasses) { 31 for (var equivalenceClass in equivalenceClasses) {
32 equivalenceClass.forEach((name, member) { 32 equivalenceClass.forEach((name, member) {
33 equivalenceClass.forEach((otherName, otherMember) { 33 equivalenceClass.forEach((otherName, otherMember) {
34 // Reflexivity, symmetry and transitivity. 34 // Reflexivity, symmetry and transitivity.
35 Expect.equals(member, 35 Expect.equals(member,
36 otherMember, 36 otherMember,
37 "$name == $otherName"); 37 "$name == $otherName");
38 Expect.equals(member.hashCode, 38 Expect.equals(member.hashCode,
39 otherMember.hashCode, 39 otherMember.hashCode,
40 "$name.hashCode == $otherName.hashCode"); 40 "$name.hashCode == $otherName.hashCode");
41 }); 41 });
42 for (var otherEquivalenceClass in equivalenceClasses) { 42 for (var otherEquivalenceClass in equivalenceClasses) {
43 if (otherEquivalenceClass == equivalenceClass) continue; 43 if (otherEquivalenceClass == equivalenceClass) continue;
44 otherEquivalenceClass.forEach((otherName, otherMember) { 44 otherEquivalenceClass.forEach((otherName, otherMember) {
45 Expect.notEquals(member, 45 Expect.notEquals(member,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType, 106 {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType,
107 'thisLibrary.declarations[#main].returnType' : 107 'thisLibrary.declarations[#main].returnType' :
108 (thisLibrary.declarations[#main] as MethodMirror).returnType}, 108 (thisLibrary.declarations[#main] as MethodMirror).returnType},
109 109
110 {'reflectClass(A)' : reflectClass(A), 110 {'reflectClass(A)' : reflectClass(A),
111 'thisLibrary.declarations[#A]' : thisLibrary.declarations[#A], 111 'thisLibrary.declarations[#A]' : thisLibrary.declarations[#A],
112 'reflect(new A<int>()).type.originalDeclaration' : 112 'reflect(new A<int>()).type.originalDeclaration' :
113 reflect(new A<int>()).type.originalDeclaration}, 113 reflect(new A<int>()).type.originalDeclaration},
114 114
115 {'reflectClass(B).superclass' : reflectClass(B).superclass, /// 02: ok 115 {'reflectClass(B).superclass' : reflectClass(B).superclass,
116 'reflect(new A<int>()).type' : reflect(new A<int>()).type}, /// 02: ok 116 'reflect(new A<int>()).type' : reflect(new A<int>()).type},
117 117
118 {'reflectClass(B)' : reflectClass(B), 118 {'reflectClass(B)' : reflectClass(B),
119 'thisLibrary.declarations[#B]' : thisLibrary.declarations[#B], 119 'thisLibrary.declarations[#B]' : thisLibrary.declarations[#B],
120 'reflect(new B()).type' : reflect(new B()).type}, 120 'reflect(new B()).type' : reflect(new B()).type},
121 121
122 {'reflectClass(BadEqualityHash).declarations[#==]' /// 02: ok 122 {'reflectClass(BadEqualityHash).declarations[#==]'
123 : reflectClass(BadEqualityHash).declarations[#==], /// 02: ok 123 : reflectClass(BadEqualityHash).declarations[#==],
124 'reflect(new BadEqualityHash()).type.declarations[#==]' /// 02: ok 124 'reflect(new BadEqualityHash()).type.declarations[#==]'
125 : reflect(new BadEqualityHash()).type.declarations[#==]}, /// 02: ok 125 : reflect(new BadEqualityHash()).type.declarations[#==]},
126 126
127 {'reflectClass(BadEqualityHash).declarations[#==].parameters[0]' /// 02: ok 127 {'reflectClass(BadEqualityHash).declarations[#==].parameters[0]'
128 : (reflectClass(BadEqualityHash).declarations[#==] as MethodMirror).para meters[0], /// 02: ok 128 : (reflectClass(BadEqualityHash).
129 'reflect(new BadEqualityHash()).type.declarations[#==].parameters[0]' /// 02: ok 129 declarations[#==] as MethodMirror).parameters[0],
130 : (reflect(new BadEqualityHash()).type.declarations[#==] as MethodMirror ).parameters[0]}, /// 02: ok 130 'reflect(new BadEqualityHash()).type.declarations[#==].parameters[0]'
131 : (reflect(new BadEqualityHash()).type.
132 declarations[#==] as MethodMirror).parameters[0]},
131 133
132 {'reflectClass(BadEqualityHash).declarations[#count]' /// 02: ok 134 {'reflectClass(BadEqualityHash).declarations[#count]'
133 : reflectClass(BadEqualityHash).declarations[#count], /// 02: ok 135 : reflectClass(BadEqualityHash).declarations[#count],
134 'reflect(new BadEqualityHash()).type.declarations[#count]' /// 02: ok 136 'reflect(new BadEqualityHash()).type.declarations[#count]'
135 : reflect(new BadEqualityHash()).type.declarations[#count]}, /// 02: ok 137 : reflect(new BadEqualityHash()).type.declarations[#count]},
136 138
137 {'reflectType(Predicate)' : reflectType(Predicate), /// 02: ok 139 {'reflectType(Predicate)' : reflectType(Predicate), /// 02: ok
138 'thisLibrary.declarations[#somePredicate].type' /// 02: ok 140 'thisLibrary.declarations[#somePredicate].type' /// 02: ok
139 : (thisLibrary.declarations[#somePredicate] as VariableMirror).type}, / // 02: ok 141 : (thisLibrary.declarations[#somePredicate] as VariableMirror).type}, / // 02: ok
140 142
141 {'reflectType(Predicate).referent' : (reflectType(Predicate) as TypedefMirro r).referent, /// 02: ok 143 {'reflectType(Predicate).referent' : (reflectType(Predicate) as TypedefMirro r).referent, /// 02: ok
142 'thisLibrary.declarations[#somePredicate].type.referent' /// 02: ok 144 'thisLibrary.declarations[#somePredicate].type.referent' /// 02: ok
143 : ((thisLibrary.declarations[#somePredicate] as VariableMirror).type as TypedefMirror).referent}, /// 02: ok 145 : ((thisLibrary.declarations[#somePredicate] as VariableMirror).type as TypedefMirror).referent}, /// 02: ok
144 146
145 {'reflectClass(A).typeVariables.single' /// 02: ok 147 {'reflectClass(A).typeVariables.single'
146 : reflectClass(A).typeVariables.single, /// 02: ok 148 : reflectClass(A).typeVariables.single,
147 'reflect(new A<int>()).type.originalDeclaration.typeVariables.single' /// 02: ok 149 'reflect(new A<int>()).type.originalDeclaration.typeVariables.single'
148 : reflect(new A<int>()).type.originalDeclaration.typeVariables.single}, /// 02: ok 150 : reflect(new A<int>()).type.originalDeclaration.typeVariables.single},
149 151
150 {'currentMirrorSystem()' : currentMirrorSystem()}, 152 {'currentMirrorSystem()' : currentMirrorSystem()},
151 153
152 {'currentMirrorSystem().isolate' : currentMirrorSystem().isolate}, 154 {'currentMirrorSystem().isolate' : currentMirrorSystem().isolate},
153 155
154 {'thisLibrary' : thisLibrary, 156 {'thisLibrary' : thisLibrary,
155 'reflectClass(A).owner' : reflectClass(A).owner, 157 'reflectClass(A).owner' : reflectClass(A).owner,
156 'reflectClass(B).owner' : reflectClass(B).owner, 158 'reflectClass(B).owner' : reflectClass(B).owner,
157 'reflect(new A()).type.owner' : reflect(new A()).type.owner, 159 'reflect(new A()).type.owner' : reflect(new A()).type.owner,
158 'reflect(new B()).type.owner' : reflect(new B()).type.owner}, 160 'reflect(new B()).type.owner' : reflect(new B()).type.owner},
159 ]); 161 ]);
160 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698