| Index: dart/tests/lib/mirrors/mixin_test.dart
|
| diff --git a/dart/tests/lib/mirrors/mixin_test.dart b/dart/tests/lib/mirrors/mixin_test.dart
|
| index e885945d597e1bcf26ce40993698667b573fdd97..4a21544bb296e41e7cc5b84d71c7976983e63ae2 100644
|
| --- a/dart/tests/lib/mirrors/mixin_test.dart
|
| +++ b/dart/tests/lib/mirrors/mixin_test.dart
|
| @@ -2,6 +2,11 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +// This test uses the multi-test "ok" feature to create two positive tests from
|
| +// one file. One of these tests fail on dart2js, but pass on the VM, or vice
|
| +// versa.
|
| +// TODO(ahe): When both implementations agree, remove the multi-test parts.
|
| +
|
| library test.mixin_test;
|
|
|
| import 'dart:mirrors';
|
| @@ -61,13 +66,14 @@ testMixin() {
|
| 'Class(s(Mixin) in s(test.mixin_test), top-level)',
|
| 'Class(s(Object) in s(dart.core), top-level)',
|
| ]);
|
| +
|
| expect(
|
| '{i: Variable(s(i) in s(Mixin)),'
|
| ' m: Method(s(m) in s(Mixin))}',
|
| reflectClass(Mixin).members);
|
| - expect(
|
| - '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
|
| - reflectClass(Mixin).constructors);
|
| +
|
| + expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
|
| + reflectClass(Mixin).constructors);
|
| }
|
|
|
| testMixin2() {
|
| @@ -75,13 +81,14 @@ testMixin2() {
|
| 'Class(s(Mixin2) in s(test.mixin_test), top-level)',
|
| 'Class(s(Object) in s(dart.core), top-level)',
|
| ]);
|
| +
|
| expect(
|
| '{i2: Variable(s(i2) in s(Mixin2)),'
|
| ' m2: Method(s(m2) in s(Mixin2))}',
|
| reflectClass(Mixin2).members);
|
| - expect(
|
| - '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
|
| - reflectClass(Mixin2).constructors);
|
| +
|
| + expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
|
| + reflectClass(Mixin2).constructors);
|
| }
|
|
|
| testMixinApplication() {
|
| @@ -93,33 +100,40 @@ testMixinApplication() {
|
| 'Class(s(Object) in s(dart.core), top-level)',
|
| ]);
|
|
|
| + String owner = 'Mixin';
|
| + owner = 'MixinApplication'; /// 01: ok
|
| expect(
|
| - '{i: Variable(s(i) in s(Mixin)),'
|
| - ' m: Method(s(m) in s(Mixin))}',
|
| + '{i: Variable(s(i) in s($owner)),'
|
| + ' m: Method(s(m) in s($owner))}',
|
| reflectClass(MixinApplication).members);
|
| - expect(
|
| - '{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
|
| - ' constructor)}',
|
| - reflectClass(MixinApplication).constructors);
|
| +
|
| + expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
|
| + ' constructor)}',
|
| + reflectClass(MixinApplication).constructors);
|
|
|
| expectSame(reflectClass(C), reflectClass(MixinApplication).superclass);
|
| }
|
|
|
| testMixinApplicationA() {
|
| + // TODO(ahe): I don't think an anonymous mixin has an owner.
|
| + String owner = ' in s(test.mixin_test)';
|
| + owner = ''; /// 01: ok
|
| checkClass(MixinApplicationA, [
|
| 'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
|
| - 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
|
| - ' top-level)',
|
| + 'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
|
| 'Class(s(C) in s(test.model), top-level)',
|
| 'Class(s(B) in s(test.model), top-level)',
|
| 'Class(s(A) in s(test.model), top-level)',
|
| 'Class(s(Object) in s(dart.core), top-level)',
|
| ]);
|
|
|
| + owner = 'Mixin2';
|
| + owner = 'MixinApplicationA'; /// 01: ok
|
| expect(
|
| - '{i2: Variable(s(i2) in s(Mixin2)),'
|
| - ' m2: Method(s(m2) in s(Mixin2))}',
|
| + '{i2: Variable(s(i2) in s($owner)),'
|
| + ' m2: Method(s(m2) in s($owner))}',
|
| reflectClass(MixinApplicationA).members);
|
| +
|
| expect(
|
| '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),'
|
| ' constructor)}',
|
| @@ -129,10 +143,13 @@ testMixinApplicationA() {
|
| '{i: Variable(s(i) in s(Mixin)),'
|
| ' m: Method(s(m) in s(Mixin))}',
|
| reflectClass(MixinApplicationA).superclass.members);
|
| +
|
| + String name = 'test.model.C with test.mixin_test.Mixin';
|
| + name = 'Mixin'; /// 01: ok
|
| expect(
|
| - '{test.model.C with test.mixin_test.Mixin:'
|
| - ' Method(s(test.model.C with test.mixin_test.Mixin)'
|
| - ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
|
| + '{$name:'
|
| + ' Method(s($name)'
|
| + ' in s($name), constructor)}',
|
| reflectClass(MixinApplicationA).superclass.constructors);
|
|
|
| expectSame(
|
| @@ -149,10 +166,13 @@ testUnusedMixinApplication() {
|
| 'Class(s(Object) in s(dart.core), top-level)',
|
| ]);
|
|
|
| + String owner = 'Mixin';
|
| + owner = 'UnusedMixinApplication'; /// 01: ok
|
| expect(
|
| - '{i: Variable(s(i) in s(Mixin)),'
|
| - ' m: Method(s(m) in s(Mixin))}',
|
| + '{i: Variable(s(i) in s($owner)),'
|
| + ' m: Method(s(m) in s($owner))}',
|
| reflectClass(UnusedMixinApplication).members);
|
| +
|
| expect(
|
| '{UnusedMixinApplication: Method(s(UnusedMixinApplication)'
|
| ' in s(UnusedMixinApplication), constructor)}',
|
| @@ -162,10 +182,11 @@ testUnusedMixinApplication() {
|
| }
|
|
|
| testSubclass() {
|
| + String owner = ' in s(test.mixin_test)';
|
| + owner = ''; /// 01: ok
|
| checkClass(Subclass, [
|
| 'Class(s(Subclass) in s(test.mixin_test), top-level)',
|
| - 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
|
| - ' top-level)',
|
| + 'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
|
| 'Class(s(C) in s(test.model), top-level)',
|
| 'Class(s(B) in s(test.model), top-level)',
|
| 'Class(s(A) in s(test.model), top-level)',
|
| @@ -175,6 +196,7 @@ testSubclass() {
|
| expect(
|
| '{f: Method(s(f) in s(Subclass))}',
|
| reflectClass(Subclass).members);
|
| +
|
| expect(
|
| '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}',
|
| reflectClass(Subclass).constructors);
|
| @@ -183,10 +205,13 @@ testSubclass() {
|
| '{i: Variable(s(i) in s(Mixin)),'
|
| ' m: Method(s(m) in s(Mixin))}',
|
| reflectClass(Subclass).superclass.members);
|
| +
|
| + String name = 'test.model.C with test.mixin_test.Mixin';
|
| + name = 'Mixin'; /// 01: ok
|
| expect(
|
| - '{test.model.C with test.mixin_test.Mixin:'
|
| - ' Method(s(test.model.C with test.mixin_test.Mixin)'
|
| - ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
|
| + '{$name:'
|
| + ' Method(s($name)'
|
| + ' in s($name), constructor)}',
|
| reflectClass(Subclass).superclass.constructors);
|
|
|
| expectSame(
|
| @@ -207,6 +232,7 @@ testSubclass2() {
|
| expect(
|
| '{g: Method(s(g) in s(Subclass2))}',
|
| reflectClass(Subclass2).members);
|
| +
|
| expect(
|
| '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}',
|
| reflectClass(Subclass2).constructors);
|
| @@ -217,12 +243,14 @@ testSubclass2() {
|
| }
|
|
|
| testSubclassA() {
|
| + // TODO(ahe): I don't think an anonymous mixin has an owner.
|
| + String owner = ' in s(test.mixin_test)';
|
| + owner = ''; /// 01: ok
|
| checkClass(SubclassA, [
|
| 'Class(s(SubclassA) in s(test.mixin_test), top-level)',
|
| 'Class(s(test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2)'
|
| - ' in s(test.mixin_test), top-level)',
|
| - 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
|
| - ' top-level)',
|
| + '$owner, top-level)',
|
| + 'Class(s(test.model.C with test.mixin_test.Mixin)$owner, top-level)',
|
| 'Class(s(C) in s(test.model), top-level)',
|
| 'Class(s(B) in s(test.model), top-level)',
|
| 'Class(s(A) in s(test.model), top-level)',
|
| @@ -232,6 +260,7 @@ testSubclassA() {
|
| expect(
|
| '{fa: Method(s(fa) in s(SubclassA))}',
|
| reflectClass(SubclassA).members);
|
| +
|
| expect(
|
| '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}',
|
| reflectClass(SubclassA).constructors);
|
| @@ -240,21 +269,25 @@ testSubclassA() {
|
| '{i2: Variable(s(i2) in s(Mixin2)),'
|
| ' m2: Method(s(m2) in s(Mixin2))}',
|
| reflectClass(SubclassA).superclass.members);
|
| +
|
| + String name =
|
| + 'test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2';
|
| + name = 'Mixin2'; /// 01: ok
|
| expect(
|
| - '{test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2:'
|
| - ' Method(s(test.model.C with test.mixin_test.Mixin,'
|
| - ' test.mixin_test.Mixin2) in s(test.model.C with test.mixin_test.Mixin,'
|
| - ' test.mixin_test.Mixin2), constructor)}',
|
| + '{$name: Method(s($name) in s($name), constructor)}',
|
| reflectClass(SubclassA).superclass.constructors);
|
|
|
| expect(
|
| '{i: Variable(s(i) in s(Mixin)),'
|
| ' m: Method(s(m) in s(Mixin))}',
|
| reflectClass(SubclassA).superclass.superclass.members);
|
| +
|
| + name = 'test.model.C with test.mixin_test.Mixin';
|
| + name = 'Mixin'; /// 01: ok
|
| expect(
|
| - '{test.model.C with test.mixin_test.Mixin:'
|
| - ' Method(s(test.model.C with test.mixin_test.Mixin)'
|
| - ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
|
| + '{$name:'
|
| + ' Method(s($name)'
|
| + ' in s($name), constructor)}',
|
| reflectClass(SubclassA).superclass.superclass.constructors);
|
|
|
| expectSame(
|
| @@ -263,10 +296,13 @@ testSubclassA() {
|
| }
|
|
|
| testSubclass2A() {
|
| + // TODO(ahe): I don't think an anonymous mixin has an owner.
|
| + String owner = ' in s(test.mixin_test)';
|
| + owner = ''; /// 01: ok
|
| checkClass(Subclass2A, [
|
| 'Class(s(Subclass2A) in s(test.mixin_test), top-level)',
|
| 'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
|
| - 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
|
| + 'Class(s(test.model.C with test.mixin_test.Mixin)$owner,'
|
| ' top-level)',
|
| 'Class(s(C) in s(test.model), top-level)',
|
| 'Class(s(B) in s(test.model), top-level)',
|
| @@ -277,6 +313,7 @@ testSubclass2A() {
|
| expect(
|
| '{ga: Method(s(ga) in s(Subclass2A))}',
|
| reflectClass(Subclass2A).members);
|
| +
|
| expect(
|
| '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}',
|
| reflectClass(Subclass2A).constructors);
|
|
|