Chromium Code Reviews| Index: tests/lib/mirrors/mixin_members_test.dart |
| diff --git a/tests/lib/mirrors/mixin_members_test.dart b/tests/lib/mirrors/mixin_members_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bd12e8d5fde792ffa7611eaff70fea6d3ea7b420 |
| --- /dev/null |
| +++ b/tests/lib/mirrors/mixin_members_test.dart |
| @@ -0,0 +1,43 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// 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. |
| + |
| +import "dart:mirrors"; |
| + |
| +import "package:expect/expect.dart"; |
| + |
| +setsEqual(Set a, Set b) => a.difference(b).length == 0 && |
| + b.difference(a).length == 0; |
| + |
| +iterablesEqual(Iterable a, Iterable b) => setsEqual(a.toSet(), b.toSet()); |
|
rmacnak
2013/07/30 19:10:50
This is a misleading name. I expect iterables to b
Michael Lippautz (Google)
2013/07/30 19:45:50
Done.
|
| + |
| +class S { |
| + foo1() {} |
| + foo2() {} |
| +} |
| + |
| +class M1 { |
| + bar1() {} |
| + bar2() {} |
| +} |
| + |
| +class M2 { |
| + baz1() {} |
| + baz2() {} |
| +} |
| + |
| +class O extends S with M1, M2 {} |
| + |
| +main() { |
| + ClassMirror cm = reflectClass(O); |
| + Classmirror S_M1_M2 = cm.superclass; |
| + Classmirror S_M1 = S_M1_M2.superclass; |
| + ClassMirror S = S_M1.superclass; |
| + Expect.equals(true, cm.members.length == 0); |
|
rmacnak
2013/07/30 19:10:50
Expect.equals(0, cm.members.length)
Michael Lippautz (Google)
2013/07/30 19:45:50
Done.
|
| + Expect.equals(true, iterablesEqual( |
|
rmacnak
2013/07/30 19:10:50
Expect.isTrue(...)
Michael Lippautz (Google)
2013/07/30 19:45:50
Done.
|
| + S_M1_M2.members.keys, [const Symbol("baz1"), const Symbol("baz2")])); |
| + Expect.equals(true, iterablesEqual( |
| + S_M1.members.keys, [const Symbol("bar1"), const Symbol("bar2")])); |
| + Expect.equals(true, iterablesEqual( |
| + S.members.keys.toSet(), [const Symbol("foo1"), const Symbol("foo2")])); |
| +} |