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

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

Issue 654903002: Remove ResolutionEnqueuer.isLive (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add test. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « tests/compiler/dart2js/cpa_inference_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) 2014, 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 instantiated_classes_test;
6
7 import 'dart:async';
8 import 'package:expect/expect.dart';
9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/implementation/elements/elements.dart'
11 show ClassElement;
12 import 'type_test_helper.dart';
13
14 void main() {
15 asyncTest(() => Future.forEach([
16 () => test("class Class {}", ["Class"]),
17 () => test("""abstract class A {}
18 class Class extends A {}""",
19 ["Class"]),
20 () => test("""class A {}
21 class Class extends A {}""",
22 ["Class"]),
23 () => test("""class A {}
24 class B {}
25 class Class extends A {}""",
26 ["Class"]),
27 () => test("""class A {}
28 class Class implements A {}""",
29 ["Class"]),
30 () => test("""class A {}
31 class Class extends Object with A {}""",
32 ["Class"]),
33 () => test("""class A {}
34 class B {}
35 class Class extends Object with B implements A {}""",
36 ["Class"]),
37
38 () => test("""class A {}
39 class Class {}""",
40 ["Class", "A"], ["Class", "A"]),
41 () => test("""class A {}
42 class Class extends A {}""",
43 ["Class", "A"], ["Class", "A"]),
44 () => test("""class A {}
45 class Class implements A {}""",
46 ["Class", "A"], ["Class", "A"]),
47 () => test("""class A {}
48 class B extends A {}
49 class Class extends B {}""",
50 ["Class", "A"], ["Class", "A"]),
51 () => test("""class A {}
52 class B {}
53 class Class extends B with A {}""",
54 ["Class", "A"], ["Class", "A"]),
55
56 // TODO(johnniwinther): Avoid registration of `Class` as instantiated.
57 () => test("""class A {}
58 class Class implements A {
59 factory Class() = A;
60 }""",
61 ["Class", "A"], ["Class"]),
62 ], (f) => f()));
63 }
64
65 Future test(String source, List<String> directlyInstantiatedClasses,
66 [List<String> newClasses = const <String>["Class"]]) {
67 StringBuffer mainSource = new StringBuffer();
68 mainSource.write('main() {\n');
69 for (String newClass in newClasses) {
70 mainSource.write(' new $newClass();\n');
71 }
72 mainSource.write('}');
73 return TypeEnvironment.create(source,
74 mainSource: mainSource.toString(),
75 useMockCompiler: true).then((env) {
76 Iterable<ClassElement> expectedClasses =
77 directlyInstantiatedClasses.map(env.getElement);
78 Iterable<ClassElement> actualClasses =
79 env.compiler.resolverWorld.directlyInstantiatedClasses.where(
80 (c) => c.library == env.compiler.mainApp);
81 Expect.setEquals(expectedClasses, actualClasses);
82 });
83 }
84
85
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/cpa_inference_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698