Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import "dart:mirrors"; | |
| 6 | |
| 7 import "package:expect/expect.dart"; | |
| 8 | |
| 9 setsEqual(Set a, Set b) => a.difference(b).length == 0 && | |
| 10 b.difference(a).length == 0; | |
| 11 | |
| 12 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.
| |
| 13 | |
| 14 class S { | |
| 15 foo1() {} | |
| 16 foo2() {} | |
| 17 } | |
| 18 | |
| 19 class M1 { | |
| 20 bar1() {} | |
| 21 bar2() {} | |
| 22 } | |
| 23 | |
| 24 class M2 { | |
| 25 baz1() {} | |
| 26 baz2() {} | |
| 27 } | |
| 28 | |
| 29 class O extends S with M1, M2 {} | |
| 30 | |
| 31 main() { | |
| 32 ClassMirror cm = reflectClass(O); | |
| 33 Classmirror S_M1_M2 = cm.superclass; | |
| 34 Classmirror S_M1 = S_M1_M2.superclass; | |
| 35 ClassMirror S = S_M1.superclass; | |
| 36 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.
| |
| 37 Expect.equals(true, iterablesEqual( | |
|
rmacnak
2013/07/30 19:10:50
Expect.isTrue(...)
Michael Lippautz (Google)
2013/07/30 19:45:50
Done.
| |
| 38 S_M1_M2.members.keys, [const Symbol("baz1"), const Symbol("baz2")])); | |
| 39 Expect.equals(true, iterablesEqual( | |
| 40 S_M1.members.keys, [const Symbol("bar1"), const Symbol("bar2")])); | |
| 41 Expect.equals(true, iterablesEqual( | |
| 42 S.members.keys.toSet(), [const Symbol("foo1"), const Symbol("foo2")])); | |
| 43 } | |
| OLD | NEW |