| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 testMixinApplication() { | 111 testMixinApplication() { |
| 112 checkClass(MixinApplication, [ | 112 checkClass(MixinApplication, [ |
| 113 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', | 113 'Class(s(MixinApplication) in s(test.mixin_application_test), top-level)', |
| 114 'Class(s(C) in s(test.model), top-level)', | 114 'Class(s(C) in s(test.model), top-level)', |
| 115 'Class(s(B) in s(test.model), top-level)', | 115 'Class(s(B) in s(test.model), top-level)', |
| 116 'Class(s(A) in s(test.model), top-level)', | 116 'Class(s(A) in s(test.model), top-level)', |
| 117 'Class(s(Object) in s(dart.core), top-level)', | 117 'Class(s(Object) in s(dart.core), top-level)', |
| 118 ]); | 118 ]); |
| 119 | 119 |
| 120 String owner = 'Mixin'; | 120 String owner = 'Mixin'; |
| 121 owner = 'MixinApplication'; /// 01: ok | |
| 122 expect( | 121 expect( |
| 123 '{i: Variable(s(i) in s($owner)),' | 122 '{i: Variable(s(i) in s($owner)),' |
| 124 ' m: Method(s(m) in s($owner))}', | 123 ' m: Method(s(m) in s($owner))}', |
| 125 membersOf(reflectClass(MixinApplication))); | 124 membersOf(reflectClass(MixinApplication))); |
| 126 | 125 |
| 127 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' | 126 expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),' |
| 128 ' constructor)}', | 127 ' constructor)}', |
| 129 constructorsOf(reflectClass(MixinApplication))); | 128 constructorsOf(reflectClass(MixinApplication))); |
| 130 | 129 |
| 131 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); | 130 expectSame(reflectClass(C), reflectClass(MixinApplication).superclass); |
| 132 } | 131 } |
| 133 | 132 |
| 134 testMixinApplicationA() { | 133 testMixinApplicationA() { |
| 135 // TODO(ahe): I don't think an anonymous mixin has an owner. | |
| 136 String owner = ' in s(test.mixin_application_test)'; | 134 String owner = ' in s(test.mixin_application_test)'; |
| 137 owner = ''; /// 01: ok | |
| 138 checkClass(MixinApplicationA, [ | 135 checkClass(MixinApplicationA, [ |
| 139 'Class(s(MixinApplicationA)' | 136 'Class(s(MixinApplicationA)' |
| 140 ' in s(test.mixin_application_test), top-level)', | 137 ' in s(test.mixin_application_test), top-level)', |
| 141 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 138 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 142 '$owner, top-level)', | 139 '$owner, top-level)', |
| 143 'Class(s(C) in s(test.model), top-level)', | 140 'Class(s(C) in s(test.model), top-level)', |
| 144 'Class(s(B) in s(test.model), top-level)', | 141 'Class(s(B) in s(test.model), top-level)', |
| 145 'Class(s(A) in s(test.model), top-level)', | 142 'Class(s(A) in s(test.model), top-level)', |
| 146 'Class(s(Object) in s(dart.core), top-level)', | 143 'Class(s(Object) in s(dart.core), top-level)', |
| 147 ]); | 144 ]); |
| 148 | 145 |
| 149 owner = 'Mixin2'; | 146 owner = 'Mixin2'; |
| 150 owner = 'MixinApplicationA'; /// 01: ok | |
| 151 expect( | 147 expect( |
| 152 '{i2: Variable(s(i2) in s($owner)),' | 148 '{i2: Variable(s(i2) in s($owner)),' |
| 153 ' m2: Method(s(m2) in s($owner))}', | 149 ' m2: Method(s(m2) in s($owner))}', |
| 154 membersOf(reflectClass(MixinApplicationA))); | 150 membersOf(reflectClass(MixinApplicationA))); |
| 155 | 151 |
| 156 expect( | 152 expect( |
| 157 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' | 153 '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),' |
| 158 ' constructor)}', | 154 ' constructor)}', |
| 159 constructorsOf(reflectClass(MixinApplicationA))); | 155 constructorsOf(reflectClass(MixinApplicationA))); |
| 160 | 156 |
| 161 expect( | 157 expect( |
| 162 '{i: Variable(s(i) in s(Mixin)),' | 158 '{i: Variable(s(i) in s(Mixin)),' |
| 163 ' m: Method(s(m) in s(Mixin))}', | 159 ' m: Method(s(m) in s(Mixin))}', |
| 164 membersOf(reflectClass(MixinApplicationA).superclass)); | 160 membersOf(reflectClass(MixinApplicationA).superclass)); |
| 165 | 161 |
| 166 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 162 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 167 name = 'Mixin'; /// 01: ok | |
| 168 expect( | 163 expect( |
| 169 '{$name:' | 164 '{$name:' |
| 170 ' Method(s($name)' | 165 ' Method(s($name)' |
| 171 ' in s($name), constructor)}', | 166 ' in s($name), constructor)}', |
| 172 constructorsOf(reflectClass(MixinApplicationA).superclass)); | 167 constructorsOf(reflectClass(MixinApplicationA).superclass)); |
| 173 | 168 |
| 174 expectSame( | 169 expectSame( |
| 175 reflectClass(C), | 170 reflectClass(C), |
| 176 reflectClass(MixinApplicationA).superclass.superclass); | 171 reflectClass(MixinApplicationA).superclass.superclass); |
| 177 } | 172 } |
| 178 | 173 |
| 179 testUnusedMixinApplication() { | 174 testUnusedMixinApplication() { |
| 180 checkClass(UnusedMixinApplication, [ | 175 checkClass(UnusedMixinApplication, [ |
| 181 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' | 176 'Class(s(UnusedMixinApplication) in s(test.mixin_application_test),' |
| 182 ' top-level)', | 177 ' top-level)', |
| 183 'Class(s(C) in s(test.model), top-level)', | 178 'Class(s(C) in s(test.model), top-level)', |
| 184 'Class(s(B) in s(test.model), top-level)', | 179 'Class(s(B) in s(test.model), top-level)', |
| 185 'Class(s(A) in s(test.model), top-level)', | 180 'Class(s(A) in s(test.model), top-level)', |
| 186 'Class(s(Object) in s(dart.core), top-level)', | 181 'Class(s(Object) in s(dart.core), top-level)', |
| 187 ]); | 182 ]); |
| 188 | 183 |
| 189 String owner = 'Mixin'; | 184 String owner = 'Mixin'; |
| 190 owner = 'UnusedMixinApplication'; /// 01: ok | |
| 191 expect( | 185 expect( |
| 192 '{i: Variable(s(i) in s($owner)),' | 186 '{i: Variable(s(i) in s($owner)),' |
| 193 ' m: Method(s(m) in s($owner))}', | 187 ' m: Method(s(m) in s($owner))}', |
| 194 membersOf(reflectClass(UnusedMixinApplication))); | 188 membersOf(reflectClass(UnusedMixinApplication))); |
| 195 | 189 |
| 196 expect( | 190 expect( |
| 197 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' | 191 '{UnusedMixinApplication: Method(s(UnusedMixinApplication)' |
| 198 ' in s(UnusedMixinApplication), constructor)}', | 192 ' in s(UnusedMixinApplication), constructor)}', |
| 199 constructorsOf(reflectClass(UnusedMixinApplication))); | 193 constructorsOf(reflectClass(UnusedMixinApplication))); |
| 200 | 194 |
| 201 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); | 195 expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass); |
| 202 } | 196 } |
| 203 | 197 |
| 204 testSubclass() { | 198 testSubclass() { |
| 205 String owner = ' in s(test.mixin_application_test)'; | 199 String owner = ' in s(test.mixin_application_test)'; |
| 206 owner = ''; /// 01: ok | |
| 207 checkClass(Subclass, [ | 200 checkClass(Subclass, [ |
| 208 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', | 201 'Class(s(Subclass) in s(test.mixin_application_test), top-level)', |
| 209 'Class(s(test.model.C with test.mixin_application_test.Mixin)' | 202 'Class(s(test.model.C with test.mixin_application_test.Mixin)' |
| 210 '$owner, top-level)', | 203 '$owner, top-level)', |
| 211 'Class(s(C) in s(test.model), top-level)', | 204 'Class(s(C) in s(test.model), top-level)', |
| 212 'Class(s(B) in s(test.model), top-level)', | 205 'Class(s(B) in s(test.model), top-level)', |
| 213 'Class(s(A) in s(test.model), top-level)', | 206 'Class(s(A) in s(test.model), top-level)', |
| 214 'Class(s(Object) in s(dart.core), top-level)', | 207 'Class(s(Object) in s(dart.core), top-level)', |
| 215 ]); | 208 ]); |
| 216 | 209 |
| 217 expect( | 210 expect( |
| 218 '{f: Method(s(f) in s(Subclass))}', | 211 '{f: Method(s(f) in s(Subclass))}', |
| 219 membersOf(reflectClass(Subclass))); | 212 membersOf(reflectClass(Subclass))); |
| 220 | 213 |
| 221 expect( | 214 expect( |
| 222 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', | 215 '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}', |
| 223 constructorsOf(reflectClass(Subclass))); | 216 constructorsOf(reflectClass(Subclass))); |
| 224 | 217 |
| 225 expect( | 218 expect( |
| 226 '{i: Variable(s(i) in s(Mixin)),' | 219 '{i: Variable(s(i) in s(Mixin)),' |
| 227 ' m: Method(s(m) in s(Mixin))}', | 220 ' m: Method(s(m) in s(Mixin))}', |
| 228 membersOf(reflectClass(Subclass).superclass)); | 221 membersOf(reflectClass(Subclass).superclass)); |
| 229 | 222 |
| 230 String name = 'test.model.C with test.mixin_application_test.Mixin'; | 223 String name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 231 name = 'Mixin'; /// 01: ok | |
| 232 expect( | 224 expect( |
| 233 '{$name:' | 225 '{$name:' |
| 234 ' Method(s($name)' | 226 ' Method(s($name)' |
| 235 ' in s($name), constructor)}', | 227 ' in s($name), constructor)}', |
| 236 constructorsOf(reflectClass(Subclass).superclass)); | 228 constructorsOf(reflectClass(Subclass).superclass)); |
| 237 | 229 |
| 238 expectSame( | 230 expectSame( |
| 239 reflectClass(C), | 231 reflectClass(C), |
| 240 reflectClass(Subclass).superclass.superclass); | 232 reflectClass(Subclass).superclass.superclass); |
| 241 } | 233 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 257 expect( | 249 expect( |
| 258 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', | 250 '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}', |
| 259 constructorsOf(reflectClass(Subclass2))); | 251 constructorsOf(reflectClass(Subclass2))); |
| 260 | 252 |
| 261 expectSame( | 253 expectSame( |
| 262 reflectClass(MixinApplication), | 254 reflectClass(MixinApplication), |
| 263 reflectClass(Subclass2).superclass); | 255 reflectClass(Subclass2).superclass); |
| 264 } | 256 } |
| 265 | 257 |
| 266 testSubclassA() { | 258 testSubclassA() { |
| 267 // TODO(ahe): I don't think an anonymous mixin has an owner. | |
| 268 String owner = ' in s(test.mixin_application_test)'; | 259 String owner = ' in s(test.mixin_application_test)'; |
| 269 owner = ''; /// 01: ok | |
| 270 checkClass(SubclassA, [ | 260 checkClass(SubclassA, [ |
| 271 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', | 261 'Class(s(SubclassA) in s(test.mixin_application_test), top-level)', |
| 272 'Class(s(test.model.C with test.mixin_application_test.Mixin,' | 262 'Class(s(test.model.C with test.mixin_application_test.Mixin,' |
| 273 ' test.mixin_application_test.Mixin2)$owner, top-level)', | 263 ' test.mixin_application_test.Mixin2)$owner, top-level)', |
| 274 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 264 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 275 ' top-level)', | 265 ' top-level)', |
| 276 'Class(s(C) in s(test.model), top-level)', | 266 'Class(s(C) in s(test.model), top-level)', |
| 277 'Class(s(B) in s(test.model), top-level)', | 267 'Class(s(B) in s(test.model), top-level)', |
| 278 'Class(s(A) in s(test.model), top-level)', | 268 'Class(s(A) in s(test.model), top-level)', |
| 279 'Class(s(Object) in s(dart.core), top-level)', | 269 'Class(s(Object) in s(dart.core), top-level)', |
| 280 ]); | 270 ]); |
| 281 | 271 |
| 282 expect( | 272 expect( |
| 283 '{fa: Method(s(fa) in s(SubclassA))}', | 273 '{fa: Method(s(fa) in s(SubclassA))}', |
| 284 membersOf(reflectClass(SubclassA))); | 274 membersOf(reflectClass(SubclassA))); |
| 285 | 275 |
| 286 expect( | 276 expect( |
| 287 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', | 277 '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}', |
| 288 constructorsOf(reflectClass(SubclassA))); | 278 constructorsOf(reflectClass(SubclassA))); |
| 289 | 279 |
| 290 expect( | 280 expect( |
| 291 '{i2: Variable(s(i2) in s(Mixin2)),' | 281 '{i2: Variable(s(i2) in s(Mixin2)),' |
| 292 ' m2: Method(s(m2) in s(Mixin2))}', | 282 ' m2: Method(s(m2) in s(Mixin2))}', |
| 293 membersOf(reflectClass(SubclassA).superclass)); | 283 membersOf(reflectClass(SubclassA).superclass)); |
| 294 | 284 |
| 295 String name = | 285 String name = |
| 296 'test.model.C with test.mixin_application_test.Mixin,' | 286 'test.model.C with test.mixin_application_test.Mixin,' |
| 297 ' test.mixin_application_test.Mixin2'; | 287 ' test.mixin_application_test.Mixin2'; |
| 298 name = 'Mixin2'; /// 01: ok | |
| 299 expect( | 288 expect( |
| 300 '{$name: Method(s($name) in s($name), constructor)}', | 289 '{$name: Method(s($name) in s($name), constructor)}', |
| 301 constructorsOf(reflectClass(SubclassA).superclass)); | 290 constructorsOf(reflectClass(SubclassA).superclass)); |
| 302 | 291 |
| 303 expect( | 292 expect( |
| 304 '{i: Variable(s(i) in s(Mixin)),' | 293 '{i: Variable(s(i) in s(Mixin)),' |
| 305 ' m: Method(s(m) in s(Mixin))}', | 294 ' m: Method(s(m) in s(Mixin))}', |
| 306 membersOf(reflectClass(SubclassA).superclass.superclass)); | 295 membersOf(reflectClass(SubclassA).superclass.superclass)); |
| 307 | 296 |
| 308 name = 'test.model.C with test.mixin_application_test.Mixin'; | 297 name = 'test.model.C with test.mixin_application_test.Mixin'; |
| 309 name = 'Mixin'; /// 01: ok | |
| 310 expect( | 298 expect( |
| 311 '{$name:' | 299 '{$name:' |
| 312 ' Method(s($name)' | 300 ' Method(s($name)' |
| 313 ' in s($name), constructor)}', | 301 ' in s($name), constructor)}', |
| 314 constructorsOf(reflectClass(SubclassA).superclass.superclass)); | 302 constructorsOf(reflectClass(SubclassA).superclass.superclass)); |
| 315 | 303 |
| 316 expectSame( | 304 expectSame( |
| 317 reflectClass(C), | 305 reflectClass(C), |
| 318 reflectClass(SubclassA).superclass.superclass.superclass); | 306 reflectClass(SubclassA).superclass.superclass.superclass); |
| 319 } | 307 } |
| 320 | 308 |
| 321 testSubclass2A() { | 309 testSubclass2A() { |
| 322 // TODO(ahe): I don't think an anonymous mixin has an owner. | |
| 323 String owner = ' in s(test.mixin_application_test)'; | 310 String owner = ' in s(test.mixin_application_test)'; |
| 324 owner = ''; /// 01: ok | |
| 325 checkClass(Subclass2A, [ | 311 checkClass(Subclass2A, [ |
| 326 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', | 312 'Class(s(Subclass2A) in s(test.mixin_application_test), top-level)', |
| 327 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' | 313 'Class(s(MixinApplicationA) in s(test.mixin_application_test),' |
| 328 ' top-level)', | 314 ' top-level)', |
| 329 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' | 315 'Class(s(test.model.C with test.mixin_application_test.Mixin)$owner,' |
| 330 ' top-level)', | 316 ' top-level)', |
| 331 'Class(s(C) in s(test.model), top-level)', | 317 'Class(s(C) in s(test.model), top-level)', |
| 332 'Class(s(B) in s(test.model), top-level)', | 318 'Class(s(B) in s(test.model), top-level)', |
| 333 'Class(s(A) in s(test.model), top-level)', | 319 'Class(s(A) in s(test.model), top-level)', |
| 334 'Class(s(Object) in s(dart.core), top-level)', | 320 'Class(s(Object) in s(dart.core), top-level)', |
| (...skipping 15 matching lines...) Expand all Loading... |
| 350 testMixin(); | 336 testMixin(); |
| 351 testMixin2(); | 337 testMixin2(); |
| 352 testMixinApplication(); | 338 testMixinApplication(); |
| 353 testMixinApplicationA(); | 339 testMixinApplicationA(); |
| 354 testUnusedMixinApplication(); | 340 testUnusedMixinApplication(); |
| 355 testSubclass(); | 341 testSubclass(); |
| 356 testSubclass2(); | 342 testSubclass2(); |
| 357 testSubclassA(); | 343 testSubclassA(); |
| 358 testSubclass2A(); | 344 testSubclass2A(); |
| 359 } | 345 } |
| OLD | NEW |