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

Side by Side Diff: test/codegen/lib/mirrors/mixin_members_test.dart

Issue 2265533002: Add mirrors tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 months 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
OLDNEW
(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 library mixin_members_test;
6
7 import "dart:mirrors";
8
9 import "package:expect/expect.dart";
10
11 import 'stringify.dart';
12
13 abstract class Fooer {
14 foo1();
15 }
16
17 class S implements Fooer {
18 foo1() {}
19 foo2() {}
20 }
21
22 class M1 {
23 bar1() {}
24 bar2() {}
25 }
26
27 class M2 {
28 baz1() {}
29 baz2() {}
30 }
31
32 class C extends S with M1, M2 {}
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
43 main() {
44 ClassMirror cm = reflectClass(C);
45 ClassMirror sM1M2 = cm.superclass;
46 ClassMirror sM1 = sM1M2.superclass;
47 ClassMirror s = sM1.superclass;
48 expect('{}', membersOf(cm));
49 expect('[s(baz1), s(baz2)]',
50 // TODO(ahe): Shouldn't have to sort.
51 sort(membersOf(sM1M2).keys),
52 '(S with M1, M2).members');
53 expect('[s(M2)]', simpleNames(sM1M2.superinterfaces),
54 '(S with M1, M2).superinterfaces');
55 expect('[s(bar1), s(bar2)]',
56 // TODO(ahe): Shouldn't have to sort.
57 sort(membersOf(sM1).keys), '(S with M1).members');
58 expect('[s(M1)]', simpleNames(sM1.superinterfaces),
59 '(S with M1).superinterfaces');
60 expect('[s(foo1), s(foo2)]',
61 // TODO(ahe): Shouldn't have to sort.
62 sort(membersOf(s).keys), 's.members');
63 expect('[s(Fooer)]', simpleNames(s.superinterfaces), 's.superinterfaces');
64 Expect.equals(s, reflectClass(S));
65 }
OLDNEW
« no previous file with comments | « test/codegen/lib/mirrors/mixin_application_test.dart ('k') | test/codegen/lib/mirrors/mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698