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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 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 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 // Test for iterators on for [SubclassNode]. 5 // Test for iterators on for [SubclassNode].
6 6
7 library subtypeset_test; 7 library subtypeset_test;
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
11 import 'type_test_helper.dart'; 11 import 'type_test_helper.dart';
12 import 'package:compiler/src/elements/elements.dart' 12 import 'package:compiler/src/elements/elements.dart' show Element, ClassElement;
13 show Element, ClassElement;
14 import 'package:compiler/src/universe/class_set.dart'; 13 import 'package:compiler/src/universe/class_set.dart';
15 import 'package:compiler/src/world.dart'; 14 import 'package:compiler/src/world.dart';
16 15
17 void main() { 16 void main() {
18 asyncTest(() => TypeEnvironment.create(r""" 17 asyncTest(() => TypeEnvironment
18 .create(
19 r"""
19 /// A 20 /// A
20 /// / \ 21 /// / \
21 /// B C 22 /// B C
22 /// / /|\ 23 /// / /|\
23 /// D E F G 24 /// D E F G
24 /// 25 ///
25 class A { 26 class A {
26 call(H h, I i) {} // Make `H` and `I` part of the world. 27 call(H h, I i) {} // Make `H` and `I` part of the world.
27 } 28 }
28 class B extends A implements C {} 29 class B extends A implements C {}
29 class C extends A {} 30 class C extends A {}
30 class D extends B implements A {} 31 class D extends B implements A {}
31 class E extends C implements B {} 32 class E extends C implements B {}
32 class F extends C {} 33 class F extends C {}
33 class G extends C {} 34 class G extends C {}
34 class H implements C {} 35 class H implements C {}
35 class I implements H {} 36 class I implements H {}
36 """, 37 """,
37 mainSource: r""" 38 mainSource: r"""
38 main() { 39 main() {
39 new A(); 40 new A();
40 new C(); 41 new C();
41 new D(); 42 new D();
42 new E(); 43 new E();
43 new F(); 44 new F();
44 new G(); 45 new G();
45 } 46 }
46 """, 47 """,
47 useMockCompiler: false).then((env) { 48 useMockCompiler: false)
48 World world = env.compiler.world; 49 .then((env) {
50 World world = env.compiler.world;
49 51
50 ClassElement A = env.getElement("A"); 52 ClassElement A = env.getElement("A");
51 ClassElement B = env.getElement("B"); 53 ClassElement B = env.getElement("B");
52 ClassElement C = env.getElement("C"); 54 ClassElement C = env.getElement("C");
53 ClassElement D = env.getElement("D"); 55 ClassElement D = env.getElement("D");
54 ClassElement E = env.getElement("E"); 56 ClassElement E = env.getElement("E");
55 ClassElement F = env.getElement("F"); 57 ClassElement F = env.getElement("F");
56 ClassElement G = env.getElement("G"); 58 ClassElement G = env.getElement("G");
57 ClassElement H = env.getElement("H"); 59 ClassElement H = env.getElement("H");
58 ClassElement I = env.getElement("I"); 60 ClassElement I = env.getElement("I");
59 61
60 void checkClass(ClassElement cls, 62 void checkClass(ClassElement cls, List<ClassElement> subtypes) {
61 List<ClassElement> subtypes) { 63 ClassSet node = world.getClassSet(cls);
62 ClassSet node = world.getClassSet(cls); 64 print('$cls:\n${node}');
63 print('$cls:\n${node}'); 65 Expect.listEquals(
64 Expect.listEquals(subtypes, 66 subtypes,
65 node.subtypes().toList(), 67 node.subtypes().toList(),
66 "Unexpected subtypes of ${cls.name}:\n" 68 "Unexpected subtypes of ${cls.name}:\n"
67 "Expected: $subtypes\n" 69 "Expected: $subtypes\n"
68 "Found : ${node.subtypes().toList()}"); 70 "Found : ${node.subtypes().toList()}");
69 } 71 }
70 72
71 checkClass(A, [A, C, E, F, G, B, D, H, I]); 73 checkClass(A, [A, C, E, F, G, B, D, H, I]);
72 checkClass(B, [B, D, E]); 74 checkClass(B, [B, D, E]);
73 checkClass(C, [C, E, F, G, H, B, D, I]); 75 checkClass(C, [C, E, F, G, H, B, D, I]);
74 checkClass(D, [D]); 76 checkClass(D, [D]);
75 checkClass(E, [E]); 77 checkClass(E, [E]);
76 checkClass(F, [F]); 78 checkClass(F, [F]);
77 checkClass(G, [G]); 79 checkClass(G, [G]);
78 checkClass(H, [H, I]); 80 checkClass(H, [H, I]);
79 checkClass(I, [I]); 81 checkClass(I, [I]);
80 })); 82 }));
81 } 83 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/subtype_test.dart ('k') | tests/compiler/dart2js/switch_empty_default_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698