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

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

Issue 2992383002: Support use of dill in TypeEnv tests (Closed)
Patch Set: Created 3 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 instantiated_classes_test; 5 library instantiated_classes_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:compiler/src/elements/entities.dart' 10 import 'package:compiler/src/elements/entities.dart'
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 Future test(String source, List<String> directlyInstantiatedClasses, 56 Future test(String source, List<String> directlyInstantiatedClasses,
57 [List<String> newClasses = const <String>["Class"]]) { 57 [List<String> newClasses = const <String>["Class"]]) {
58 StringBuffer mainSource = new StringBuffer(); 58 StringBuffer mainSource = new StringBuffer();
59 mainSource.write('main() {\n'); 59 mainSource.write('main() {\n');
60 for (String newClass in newClasses) { 60 for (String newClass in newClasses) {
61 mainSource.write(' new $newClass();\n'); 61 mainSource.write(' new $newClass();\n');
62 } 62 }
63 mainSource.write('}'); 63 mainSource.write('}');
64 return TypeEnvironment 64 return TypeEnvironment
65 .create(source, mainSource: mainSource.toString(), useMockCompiler: true) 65 .create(source,
66 mainSource: mainSource.toString(), compileMode: CompileMode.mock)
66 .then((dynamic env) { 67 .then((dynamic env) {
67 LibraryEntity mainLibrary = 68 LibraryEntity mainLibrary =
68 env.compiler.frontendStrategy.elementEnvironment.mainLibrary; 69 env.compiler.frontendStrategy.elementEnvironment.mainLibrary;
69 Iterable<ClassEntity> expectedClasses = 70 Iterable<ClassEntity> expectedClasses =
70 directlyInstantiatedClasses.map(env.getElement); 71 directlyInstantiatedClasses.map(env.getElement);
71 Iterable<ClassEntity> actualClasses = env 72 Iterable<ClassEntity> actualClasses = env
72 .compiler.resolutionWorldBuilder.directlyInstantiatedClasses 73 .compiler.resolutionWorldBuilder.directlyInstantiatedClasses
73 .where((c) => c.library == mainLibrary); 74 .where((c) => c.library == mainLibrary);
74 Expect.setEquals(expectedClasses, actualClasses); 75 Expect.setEquals(expectedClasses, actualClasses);
75 }); 76 });
76 } 77 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/equivalence/id_equivalence_helper.dart ('k') | tests/compiler/dart2js/jsinterop/world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698