Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: tests/lib/mirrors/mixin_members_test.dart

Issue 64793003: Update mirror tests for removed API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/mirrors/mixin_application_test.dart ('k') | tests/lib/mirrors/operator_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library mixin_members_test; 5 library mixin_members_test;
6 6
7 import "dart:mirrors"; 7 import "dart:mirrors";
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 13 matching lines...) Expand all
24 bar2() {} 24 bar2() {}
25 } 25 }
26 26
27 class M2 { 27 class M2 {
28 baz1() {} 28 baz1() {}
29 baz2() {} 29 baz2() {}
30 } 30 }
31 31
32 class C extends S with M1, M2 {} 32 class C extends S with M1, M2 {}
33 33
34 membersOf(ClassMirror cm) {
35 var result = new Map();
36 cm.declarations.forEach((k,v) {
37 if(v is MethodMirror && !v.isConstructor) result[k] = v;
38 if(v is VariableMirror) result[k] = v;
39 });
40 return result;
41 }
42
34 main() { 43 main() {
35 ClassMirror cm = reflectClass(C); 44 ClassMirror cm = reflectClass(C);
36 ClassMirror sM1M2 = cm.superclass; 45 ClassMirror sM1M2 = cm.superclass;
37 ClassMirror sM1 = sM1M2.superclass; 46 ClassMirror sM1 = sM1M2.superclass;
38 ClassMirror s = sM1.superclass; 47 ClassMirror s = sM1.superclass;
39 expect('{}', cm.members); 48 expect('{}', membersOf(cm));
40 expect('[s(baz1), s(baz2)]', 49 expect('[s(baz1), s(baz2)]',
41 // TODO(ahe): Shouldn't have to sort. 50 // TODO(ahe): Shouldn't have to sort.
42 sort(sM1M2.members.keys), 51 sort(membersOf(sM1M2).keys),
43 '(S with M1, M2).members'); 52 '(S with M1, M2).members');
44 expect('[s(M2)]', simpleNames(sM1M2.superinterfaces), 53 expect('[s(M2)]', simpleNames(sM1M2.superinterfaces),
45 '(S with M1, M2).superinterfaces'); 54 '(S with M1, M2).superinterfaces');
46 expect('[s(bar1), s(bar2)]', 55 expect('[s(bar1), s(bar2)]',
47 // TODO(ahe): Shouldn't have to sort. 56 // TODO(ahe): Shouldn't have to sort.
48 sort(sM1.members.keys), '(S with M1).members'); 57 sort(membersOf(sM1).keys), '(S with M1).members');
49 expect('[s(M1)]', simpleNames(sM1.superinterfaces), 58 expect('[s(M1)]', simpleNames(sM1.superinterfaces),
50 '(S with M1).superinterfaces'); 59 '(S with M1).superinterfaces');
51 expect('[s(foo1), s(foo2)]', 60 expect('[s(foo1), s(foo2)]',
52 // TODO(ahe): Shouldn't have to sort. 61 // TODO(ahe): Shouldn't have to sort.
53 sort(s.members.keys), 's.members'); 62 sort(membersOf(s).keys), 's.members');
54 expect('[s(Fooer)]', simpleNames(s.superinterfaces), 's.superinterfaces'); 63 expect('[s(Fooer)]', simpleNames(s.superinterfaces), 's.superinterfaces');
55 Expect.equals(s, reflectClass(S)); 64 Expect.equals(s, reflectClass(S));
56 } 65 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/mixin_application_test.dart ('k') | tests/lib/mirrors/operator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698