| OLD | NEW |
| 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 test uses the multi-test "ok" feature to create two positive tests from | 5 // This test uses the multi-test "ok" feature to create two positive tests from |
| 6 // one file. One of these tests fail on dart2js, but pass on the VM, or vice | 6 // one file. One of these tests fail on dart2js, but pass on the VM, or vice |
| 7 // versa. | 7 // versa. |
| 8 // TODO(ahe): When both implementations agree, remove the multi-test parts. | 8 // TODO(ahe): When both implementations agree, remove the multi-test parts. |
| 9 | 9 |
| 10 library test.mixin_application_test; | 10 library test.mixin_application_test; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 class SubclassA extends C with Mixin, Mixin2 { | 42 class SubclassA extends C with Mixin, Mixin2 { |
| 43 fa() {} | 43 fa() {} |
| 44 } | 44 } |
| 45 | 45 |
| 46 class Subclass2A extends MixinApplicationA { | 46 class Subclass2A extends MixinApplicationA { |
| 47 ga() {} | 47 ga() {} |
| 48 } | 48 } |
| 49 | 49 |
| 50 membersOf(ClassMirror cm) { |
| 51 var result = new Map(); |
| 52 cm.declarations.forEach((k,v) { |
| 53 if(v is MethodMirror && !v.isConstructor) result[k] = v; |
| 54 if(v is VariableMirror) result[k] = v; |
| 55 }); |
| 56 return result; |
| 57 } |
| 58 |
| 59 constructorsOf(ClassMirror cm) { |
| 60 var result = new Map(); |
| 61 cm.declarations.forEach((k,v) { |
| 62 if(v is MethodMirror && v.isConstructor) result[k] = v; |
| 63 }); |
| 64 return result; |
| 65 } |
| 66 |
| 50 checkClass(Type type, List<String> expectedSuperclasses) { | 67 checkClass(Type type, List<String> expectedSuperclasses) { |
| 51 int i = 0; | 68 int i = 0; |
| 52 for (var cls = reflectClass(type); cls != null; cls = cls.superclass) { | 69 for (var cls = reflectClass(type); cls != null; cls = cls.superclass) { |
| 53 expect(expectedSuperclasses[i++], cls); | 70 expect(expectedSuperclasses[i++], cls); |
| 54 } | 71 } |
| 55 Expect.equals(i, expectedSuperclasses.length, '$type'); | 72 Expect.equals(i, expectedSuperclasses.length, '$type'); |
| 56 } | 73 } |
| 57 | 74 |
| 58 expectSame(ClassMirror a, ClassMirror b) { | 75 expectSame(ClassMirror a, ClassMirror b) { |
| 59 Expect.equals(a, b); | 76 Expect.equals(a, b); |
| 60 expect(stringify(a), b); | 77 expect(stringify(a), b); |
| 61 expect(stringify(b), a); | 78 expect(stringify(b), a); |
| 62 } | 79 } |
| 63 | 80 |
| 64 testMixin() { | 81 testMixin() { |
| 65 checkClass(Mixin, [ | 82 checkClass(Mixin, [ |
| 66 'Class(s(Mixin) in s(test.mixin_application_test), top-level)', | 83 'Class(s(Mixin) in s(test.mixin_application_test), top-level)', |
| 67 'Class(s(Object) in s(dart.core), top-level)', | 84 'Class(s(Object) in s(dart.core), top-level)', |
| 68 ]); | 85 ]); |
| 69 | 86 |
| 70 expect( | 87 expect( |
| 71 '{i: Variable(s(i) in s(Mixin)),' | 88 '{i: Variable(s(i) in s(Mixin)),' |
| 72 ' m: Method(s(m) in s(Mixin))}', | 89 ' m: Method(s(m) in s(Mixin))}', |
| 73 reflectClass(Mixin).members); | 90 membersOf(reflectClass(Mixin))); |
| 74 | 91 |
| 75 expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}', | 92 expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}', |
| 76 reflectClass(Mixin).constructors); | 93 constructorsOf(reflectClass(Mixin))); |
| 77 } | 94 } |
| 78 | 95 |
| 79 testMixin2() { | 96 testMixin2() { |
| 80 checkClass(Mixin2, [ | 97 checkClass(Mixin2, [ |
| 81 'Class(s(Mixin2) in s(test.mixin_application_test), top-level)', | 98 'Class(s(Mixin2) in s(test.mixin_application_test), top-level)', |
| 82 'Class(s(Object) in s(dart.core), top-level)', | 99 'Class(s(Object) in s(dart.core), top-level)', |
| 83 ]); | 100 ]); |
| 84 | 101 |
| 85 expect( | 102 expect( |
| 86 '{i2: Variable(s(i2) in s(Mixin2)),' | 103 '{i2: Variable(s(i2) in s(Mixin2)),' |
| 87 ' m2: Method(s(m2) in s(Mixin2))}', | 104 ' m2: Method(s(m2) in s(Mixin2))}', |
| 88 reflectClass(Mixin2).members); | 105 membersOf(reflectClass(Mixin2))); |
| 89 | 106 |
| 90 expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}', | 107 expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}', |
| 91 reflectClass(Mixin2).constructors); | 108 constructorsOf(reflectClass(Mixin2))); |
| 92 } | 109 } |
| 93 | 110 |
| 94 testMixinApplication() { | 111 testMixinApplication() { |
| 95 checkClass(MixinApplication, [ | 112 checkClass(MixinApplication, [ |
| 96 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', | 113 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', |
| 97 'Class(s(C) in s(test.model), top-level)', | 114 'Class(s(C) in s(test.model), top-level)', |
| 98 'Class(s(B) in s(test.model), top-level)', | 115 'Class(s(B) in s(test.model), top-level)', |
| 99 'Class(s(A) in s(test.model), top-level)', | 116 'Class(s(A) in s(test.model), top-level)', |
| 100 'Class(s(Object) in s(dart.core), top-level)', | 117 'Class(s(Object) in s(dart.core), top-level)', |
| 101 ]); | 118 ]); |
| 102 | 119 |
| 103 String owner = 'Mixin'; | 120 String owner = 'Mixin'; |
| 104 owner = 'MixinApplication'; /// 01: ok | 121 owner = 'MixinApplication'; /// 01: ok |
| 105 expect( | 122 expect( |
| 106 '{i: Variable(s(i) in s($owner)),' | 123 '{i: Variable(s(i) in s($owner)),' |
| 107 ' m: Method(s(m) in s($owner))}', | 124 ' m: Method(s(m) in s($owner))}', |
| 108 reflectClass(MixinApplication).members); | 125 membersOf(reflectClass(MixinApplication))); |
| 109 | 126 |
| 110 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' | 127 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' |
| 111 ' constructor)}', | 128 ' constructor)}', |
| 112 reflectClass(MixinApplication).constructors); | 129 constructorsOf(reflectClass(MixinApplication))); |
| 113 | 130 |
| 114 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); | 131 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); |
| 115 } | 132 } |
| 116 | 133 |
| 117 testMixinApplicationA() { | 134 testMixinApplicationA() { |
| 118 // TODO(ahe): I don't think an anonymous mixin has an owner. | 135 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 119 String owner = ' in s(test.mixin_application_test)'; | 136 String owner = ' in s(test.mixin_application_test)'; |
| 120 owner = ''; /// 01: ok | 137 owner = ''; /// 01: ok |
| 121 checkClass(MixinApplicationA, [ | 138 checkClass(MixinApplicationA, [ |
| 122 'Class(s(MixinApplicationA)' | 139 'Class(s(MixinApplicationA)' |
| 123 ' in s(test.mixin_application_test), top-level)', | 140 ' in s(test.mixin_application_test), top-level)', |
| 124 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 141 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 125 '$owner, top-level)', | 142 '$owner, top-level)', |
| 126 'Class(s(C) in s(test.model), top-level)', | 143 'Class(s(C) in s(test.model), top-level)', |
| 127 'Class(s(B) in s(test.model), top-level)', | 144 'Class(s(B) in s(test.model), top-level)', |
| 128 'Class(s(A) in s(test.model), top-level)', | 145 'Class(s(A) in s(test.model), top-level)', |
| 129 'Class(s(Object) in s(dart.core), top-level)', | 146 'Class(s(Object) in s(dart.core), top-level)', |
| 130 ]); | 147 ]); |
| 131 | 148 |
| 132 owner = 'Mixin2'; | 149 owner = 'Mixin2'; |
| 133 owner = 'MixinApplicationA'; /// 01: ok | 150 owner = 'MixinApplicationA'; /// 01: ok |
| 134 expect( | 151 expect( |
| 135 '{i2: Variable(s(i2) in s($owner)),' | 152 '{i2: Variable(s(i2) in s($owner)),' |
| 136 ' m2: Method(s(m2) in s($owner))}', | 153 ' m2: Method(s(m2) in s($owner))}', |
| 137 reflectClass(MixinApplicationA).members); | 154 membersOf(reflectClass(MixinApplicationA))); |
| 138 | 155 |
| 139 expect( | 156 expect( |
| 140 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' | 157 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' |
| 141 ' constructor)}', | 158 ' constructor)}', |
| 142 reflectClass(MixinApplicationA).constructors); | 159 constructorsOf(reflectClass(MixinApplicationA))); |
| 143 | 160 |
| 144 expect( | 161 expect( |
| 145 '{i: Variable(s(i) in s(Mixin)),' | 162 '{i: Variable(s(i) in s(Mixin)),' |
| 146 ' m: Method(s(m) in s(Mixin))}', | 163 ' m: Method(s(m) in s(Mixin))}', |
| 147 reflectClass(MixinApplicationA).superclass.members); | 164 membersOf(reflectClass(MixinApplicationA).superclass)); |
| 148 | 165 |
| 149 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 166 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 150 name = 'Mixin'; /// 01: ok | 167 name = 'Mixin'; /// 01: ok |
| 151 expect( | 168 expect( |
| 152 '{$name:' | 169 '{$name:' |
| 153 ' Method(s($name)' | 170 ' Method(s($name)' |
| 154 ' in s($name), constructor)}', | 171 ' in s($name), constructor)}', |
| 155 reflectClass(MixinApplicationA).superclass.constructors); | 172 constructorsOf(reflectClass(MixinApplicationA).superclass)); |
| 156 | 173 |
| 157 expectSame( | 174 expectSame( |
| 158 reflectClass(C), | 175 reflectClass(C), |
| 159 reflectClass(MixinApplicationA).superclass.superclass); | 176 reflectClass(MixinApplicationA).superclass.superclass); |
| 160 } | 177 } |
| 161 | 178 |
| 162 testUnusedMixinApplication() { | 179 testUnusedMixinApplication() { |
| 163 checkClass(UnusedMixinApplication, [ | 180 checkClass(UnusedMixinApplication, [ |
| 164 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' | 181 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' |
| 165 ' top-level)', | 182 ' top-level)', |
| 166 'Class(s(C) in s(test.model), top-level)', | 183 'Class(s(C) in s(test.model), top-level)', |
| 167 'Class(s(B) in s(test.model), top-level)', | 184 'Class(s(B) in s(test.model), top-level)', |
| 168 'Class(s(A) in s(test.model), top-level)', | 185 'Class(s(A) in s(test.model), top-level)', |
| 169 'Class(s(Object) in s(dart.core), top-level)', | 186 'Class(s(Object) in s(dart.core), top-level)', |
| 170 ]); | 187 ]); |
| 171 | 188 |
| 172 String owner = 'Mixin'; | 189 String owner = 'Mixin'; |
| 173 owner = 'UnusedMixinApplication'; /// 01: ok | 190 owner = 'UnusedMixinApplication'; /// 01: ok |
| 174 expect( | 191 expect( |
| 175 '{i: Variable(s(i) in s($owner)),' | 192 '{i: Variable(s(i) in s($owner)),' |
| 176 ' m: Method(s(m) in s($owner))}', | 193 ' m: Method(s(m) in s($owner))}', |
| 177 reflectClass(UnusedMixinApplication).members); | 194 membersOf(reflectClass(UnusedMixinApplication))); |
| 178 | 195 |
| 179 expect( | 196 expect( |
| 180 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' | 197 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' |
| 181 ' in s(UnusedMixinApplication), constructor)}', | 198 ' in s(UnusedMixinApplication), constructor)}', |
| 182 reflectClass(UnusedMixinApplication).constructors); | 199 constructorsOf(reflectClass(UnusedMixinApplication))); |
| 183 | 200 |
| 184 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); | 201 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); |
| 185 } | 202 } |
| 186 | 203 |
| 187 testSubclass() { | 204 testSubclass() { |
| 188 String owner = ' in s(test.mixin_application_test)'; | 205 String owner = ' in s(test.mixin_application_test)'; |
| 189 owner = ''; /// 01: ok | 206 owner = ''; /// 01: ok |
| 190 checkClass(Subclass, [ | 207 checkClass(Subclass, [ |
| 191 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', | 208 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', |
| 192 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 209 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 193 '$owner, top-level)', | 210 '$owner, top-level)', |
| 194 'Class(s(C) in s(test.model), top-level)', | 211 'Class(s(C) in s(test.model), top-level)', |
| 195 'Class(s(B) in s(test.model), top-level)', | 212 'Class(s(B) in s(test.model), top-level)', |
| 196 'Class(s(A) in s(test.model), top-level)', | 213 'Class(s(A) in s(test.model), top-level)', |
| 197 'Class(s(Object) in s(dart.core), top-level)', | 214 'Class(s(Object) in s(dart.core), top-level)', |
| 198 ]); | 215 ]); |
| 199 | 216 |
| 200 expect( | 217 expect( |
| 201 '{f: Method(s(f) in s(Subclass))}', | 218 '{f: Method(s(f) in s(Subclass))}', |
| 202 reflectClass(Subclass).members); | 219 membersOf(reflectClass(Subclass))); |
| 203 | 220 |
| 204 expect( | 221 expect( |
| 205 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', | 222 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', |
| 206 reflectClass(Subclass).constructors); | 223 constructorsOf(reflectClass(Subclass))); |
| 207 | 224 |
| 208 expect( | 225 expect( |
| 209 '{i: Variable(s(i) in s(Mixin)),' | 226 '{i: Variable(s(i) in s(Mixin)),' |
| 210 ' m: Method(s(m) in s(Mixin))}', | 227 ' m: Method(s(m) in s(Mixin))}', |
| 211 reflectClass(Subclass).superclass.members); | 228 membersOf(reflectClass(Subclass).superclass)); |
| 212 | 229 |
| 213 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 230 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 214 name = 'Mixin'; /// 01: ok | 231 name = 'Mixin'; /// 01: ok |
| 215 expect( | 232 expect( |
| 216 '{$name:' | 233 '{$name:' |
| 217 ' Method(s($name)' | 234 ' Method(s($name)' |
| 218 ' in s($name), constructor)}', | 235 ' in s($name), constructor)}', |
| 219 reflectClass(Subclass).superclass.constructors); | 236 constructorsOf(reflectClass(Subclass).superclass)); |
| 220 | 237 |
| 221 expectSame( | 238 expectSame( |
| 222 reflectClass(C), | 239 reflectClass(C), |
| 223 reflectClass(Subclass).superclass.superclass); | 240 reflectClass(Subclass).superclass.superclass); |
| 224 } | 241 } |
| 225 | 242 |
| 226 testSubclass2() { | 243 testSubclass2() { |
| 227 checkClass(Subclass2, [ | 244 checkClass(Subclass2, [ |
| 228 'Class(s(Subclass2) in s(test.mixin_application_test), top-level)', | 245 'Class(s(Subclass2) in s(test.mixin_application_test), top-level)', |
| 229 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', | 246 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', |
| 230 'Class(s(C) in s(test.model), top-level)', | 247 'Class(s(C) in s(test.model), top-level)', |
| 231 'Class(s(B) in s(test.model), top-level)', | 248 'Class(s(B) in s(test.model), top-level)', |
| 232 'Class(s(A) in s(test.model), top-level)', | 249 'Class(s(A) in s(test.model), top-level)', |
| 233 'Class(s(Object) in s(dart.core), top-level)', | 250 'Class(s(Object) in s(dart.core), top-level)', |
| 234 ]); | 251 ]); |
| 235 | 252 |
| 236 expect( | 253 expect( |
| 237 '{g: Method(s(g) in s(Subclass2))}', | 254 '{g: Method(s(g) in s(Subclass2))}', |
| 238 reflectClass(Subclass2).members); | 255 membersOf(reflectClass(Subclass2))); |
| 239 | 256 |
| 240 expect( | 257 expect( |
| 241 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', | 258 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', |
| 242 reflectClass(Subclass2).constructors); | 259 constructorsOf(reflectClass(Subclass2))); |
| 243 | 260 |
| 244 expectSame( | 261 expectSame( |
| 245 reflectClass(MixinApplication), | 262 reflectClass(MixinApplication), |
| 246 reflectClass(Subclass2).superclass); | 263 reflectClass(Subclass2).superclass); |
| 247 } | 264 } |
| 248 | 265 |
| 249 testSubclassA() { | 266 testSubclassA() { |
| 250 // TODO(ahe): I don't think an anonymous mixin has an owner. | 267 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 251 String owner = ' in s(test.mixin_application_test)'; | 268 String owner = ' in s(test.mixin_application_test)'; |
| 252 owner = ''; /// 01: ok | 269 owner = ''; /// 01: ok |
| 253 checkClass(SubclassA, [ | 270 checkClass(SubclassA, [ |
| 254 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', | 271 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', |
| 255 'Class(s(test.model.C with test.mixin_application_test.Mixin,' | 272 'Class(s(test.model.C with test.mixin_application_test.Mixin,' |
| 256 ' test.mixin_application_test.Mixin2)$owner, top-level)', | 273 ' test.mixin_application_test.Mixin2)$owner, top-level)', |
| 257 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 274 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 258 ' top-level)', | 275 ' top-level)', |
| 259 'Class(s(C) in s(test.model), top-level)', | 276 'Class(s(C) in s(test.model), top-level)', |
| 260 'Class(s(B) in s(test.model), top-level)', | 277 'Class(s(B) in s(test.model), top-level)', |
| 261 'Class(s(A) in s(test.model), top-level)', | 278 'Class(s(A) in s(test.model), top-level)', |
| 262 'Class(s(Object) in s(dart.core), top-level)', | 279 'Class(s(Object) in s(dart.core), top-level)', |
| 263 ]); | 280 ]); |
| 264 | 281 |
| 265 expect( | 282 expect( |
| 266 '{fa: Method(s(fa) in s(SubclassA))}', | 283 '{fa: Method(s(fa) in s(SubclassA))}', |
| 267 reflectClass(SubclassA).members); | 284 membersOf(reflectClass(SubclassA))); |
| 268 | 285 |
| 269 expect( | 286 expect( |
| 270 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', | 287 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', |
| 271 reflectClass(SubclassA).constructors); | 288 constructorsOf(reflectClass(SubclassA))); |
| 272 | 289 |
| 273 expect( | 290 expect( |
| 274 '{i2: Variable(s(i2) in s(Mixin2)),' | 291 '{i2: Variable(s(i2) in s(Mixin2)),' |
| 275 ' m2: Method(s(m2) in s(Mixin2))}', | 292 ' m2: Method(s(m2) in s(Mixin2))}', |
| 276 reflectClass(SubclassA).superclass.members); | 293 membersOf(reflectClass(SubclassA).superclass)); |
| 277 | 294 |
| 278 String name = | 295 String name = |
| 279 'test.model.C with test.mixin_application_test.Mixin,' | 296 'test.model.C with test.mixin_application_test.Mixin,' |
| 280 ' test.mixin_application_test.Mixin2'; | 297 ' test.mixin_application_test.Mixin2'; |
| 281 name = 'Mixin2'; /// 01: ok | 298 name = 'Mixin2'; /// 01: ok |
| 282 expect( | 299 expect( |
| 283 '{$name: Method(s($name) in s($name), constructor)}', | 300 '{$name: Method(s($name) in s($name), constructor)}', |
| 284 reflectClass(SubclassA).superclass.constructors); | 301 constructorsOf(reflectClass(SubclassA).superclass)); |
| 285 | 302 |
| 286 expect( | 303 expect( |
| 287 '{i: Variable(s(i) in s(Mixin)),' | 304 '{i: Variable(s(i) in s(Mixin)),' |
| 288 ' m: Method(s(m) in s(Mixin))}', | 305 ' m: Method(s(m) in s(Mixin))}', |
| 289 reflectClass(SubclassA).superclass.superclass.members); | 306 membersOf(reflectClass(SubclassA).superclass.superclass)); |
| 290 | 307 |
| 291 name = 'test.model.C with test.mixin_application_test.Mixin'; | 308 name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 292 name = 'Mixin'; /// 01: ok | 309 name = 'Mixin'; /// 01: ok |
| 293 expect( | 310 expect( |
| 294 '{$name:' | 311 '{$name:' |
| 295 ' Method(s($name)' | 312 ' Method(s($name)' |
| 296 ' in s($name), constructor)}', | 313 ' in s($name), constructor)}', |
| 297 reflectClass(SubclassA).superclass.superclass.constructors); | 314 constructorsOf(reflectClass(SubclassA).superclass.superclass)); |
| 298 | 315 |
| 299 expectSame( | 316 expectSame( |
| 300 reflectClass(C), | 317 reflectClass(C), |
| 301 reflectClass(SubclassA).superclass.superclass.superclass); | 318 reflectClass(SubclassA).superclass.superclass.superclass); |
| 302 } | 319 } |
| 303 | 320 |
| 304 testSubclass2A() { | 321 testSubclass2A() { |
| 305 // TODO(ahe): I don't think an anonymous mixin has an owner. | 322 // TODO(ahe): I don't think an anonymous mixin has an owner. |
| 306 String owner = ' in s(test.mixin_application_test)'; | 323 String owner = ' in s(test.mixin_application_test)'; |
| 307 owner = ''; /// 01: ok | 324 owner = ''; /// 01: ok |
| 308 checkClass(Subclass2A, [ | 325 checkClass(Subclass2A, [ |
| 309 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', | 326 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', |
| 310 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' | 327 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' |
| 311 ' top-level)', | 328 ' top-level)', |
| 312 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 329 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 313 ' top-level)', | 330 ' top-level)', |
| 314 'Class(s(C) in s(test.model), top-level)', | 331 'Class(s(C) in s(test.model), top-level)', |
| 315 'Class(s(B) in s(test.model), top-level)', | 332 'Class(s(B) in s(test.model), top-level)', |
| 316 'Class(s(A) in s(test.model), top-level)', | 333 'Class(s(A) in s(test.model), top-level)', |
| 317 'Class(s(Object) in s(dart.core), top-level)', | 334 'Class(s(Object) in s(dart.core), top-level)', |
| 318 ]); | 335 ]); |
| 319 | 336 |
| 320 expect( | 337 expect( |
| 321 '{ga: Method(s(ga) in s(Subclass2A))}', | 338 '{ga: Method(s(ga) in s(Subclass2A))}', |
| 322 reflectClass(Subclass2A).members); | 339 membersOf(reflectClass(Subclass2A))); |
| 323 | 340 |
| 324 expect( | 341 expect( |
| 325 '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}', | 342 '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}', |
| 326 reflectClass(Subclass2A).constructors); | 343 constructorsOf(reflectClass(Subclass2A))); |
| 327 | 344 |
| 328 expectSame(reflectClass(MixinApplicationA), | 345 expectSame(reflectClass(MixinApplicationA), |
| 329 reflectClass(Subclass2A).superclass); | 346 reflectClass(Subclass2A).superclass); |
| 330 } | 347 } |
| 331 | 348 |
| 332 main() { | 349 main() { |
| 333 testMixin(); | 350 testMixin(); |
| 334 testMixin2(); | 351 testMixin2(); |
| 335 testMixinApplication(); | 352 testMixinApplication(); |
| 336 testMixinApplicationA(); | 353 testMixinApplicationA(); |
| 337 testUnusedMixinApplication(); | 354 testUnusedMixinApplication(); |
| 338 testSubclass(); | 355 testSubclass(); |
| 339 testSubclass2(); | 356 testSubclass2(); |
| 340 testSubclassA(); | 357 testSubclassA(); |
| 341 testSubclass2A(); | 358 testSubclass2A(); |
| 342 } | 359 } |
| OLD | NEW |