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

Side by Side Diff: tests/compiler/dart2js/subtypeset_test.dart

Issue 1304083008: Add ClassSet to support ClassWorld.strictSubtypesOf (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 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
« no previous file with comments | « tests/compiler/dart2js/class_set_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 // Test for iterators on for [SubclassNode].
6
7 library world_test;
8
9 import 'package:expect/expect.dart';
10 import 'package:async_helper/async_helper.dart';
11 import 'type_test_helper.dart';
12 import 'package:compiler/src/elements/elements.dart'
13 show Element, ClassElement;
14 import 'package:compiler/src/universe/class_set.dart';
15 import 'package:compiler/src/world.dart';
16
17 void main() {
18 asyncTest(() => TypeEnvironment.create(r"""
19 /// A
20 /// / \
21 /// B C
22 /// / /|\
23 /// D E F G
24 ///
25 class A {
26 call(H h, I i) {} // Make `H` and `I` part of the world.
27 }
28 class B extends A implements C {}
29 class C extends A {}
30 class D extends B implements A {}
31 class E extends C implements B {}
32 class F extends C {}
33 class G extends C {}
34 class H implements C {}
35 class I implements H {}
36 """,
37 mainSource: r"""
38 main() {
39 new A();
40 new C();
41 new D();
42 new E();
43 new F();
44 new G();
45 }
46 """,
47 useMockCompiler: false).then((env) {
48 World world = env.compiler.world;
49
50 ClassElement A = env.getElement("A");
51 ClassElement B = env.getElement("B");
52 ClassElement C = env.getElement("C");
53 ClassElement D = env.getElement("D");
54 ClassElement E = env.getElement("E");
55 ClassElement F = env.getElement("F");
56 ClassElement G = env.getElement("G");
57 ClassElement H = env.getElement("H");
58 ClassElement I = env.getElement("I");
59
60 void checkClass(ClassElement cls,
61 List<ClassElement> subtypes) {
62 ClassSet node = world.getClassSet(cls);
63 print('$cls:\n${node}');
64 Expect.listEquals(subtypes,
65 node.subtypes().toList(),
66 "Unexpected subtypes of ${cls.name}:\n"
67 "Expected: $subtypes\n"
68 "Found : ${node.subtypes().toList()}");
69 }
70
71 checkClass(A, [A, C, E, F, G, B, D, H, I]);
72 checkClass(B, [B, D, E]);
73 checkClass(C, [C, E, F, G, H, B, D, I]);
74 checkClass(D, [D]);
75 checkClass(E, [E]);
76 checkClass(F, [F]);
77 checkClass(G, [G]);
78 checkClass(H, [H, I]);
79 checkClass(I, [I]);
80 }));
81 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/class_set_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698