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

Unified Diff: tests/compiler/dart2js/kernel/visitor_test.dart

Issue 2609433002: Fix rasta unittests: now unit tests need to run the full compiler to use its (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/kernel/class_hierarchy_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/kernel/visitor_test.dart
diff --git a/tests/compiler/dart2js/kernel/visitor_test.dart b/tests/compiler/dart2js/kernel/visitor_test.dart
index d632442f67f6493157cc6631ee059c4f53c2bc4a..e33b34df36950762aecc7bc8f5956a741f39a712 100644
--- a/tests/compiler/dart2js/kernel/visitor_test.dart
+++ b/tests/compiler/dart2js/kernel/visitor_test.dart
@@ -6,6 +6,7 @@
/// defined by kernel spec-mode test files.
import 'dart:io';
+import 'dart:async';
import 'package:compiler/src/compiler.dart' show Compiler;
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend;
@@ -26,9 +27,8 @@ const List<String> SKIP_TESTS = const <String>[
'external',
];
-main(List<String> arguments) {
- Compiler compiler = compilerFor(
- options: [Flags.analyzeOnly, Flags.analyzeMain, Flags.useKernel]);
+main(List<String> arguments) async {
+
Directory directory = new Directory('${TESTCASE_DIR}/input');
for (FileSystemEntity file in directory.listSync()) {
if (file is File && file.path.endsWith('.dart')) {
@@ -40,7 +40,10 @@ main(List<String> arguments) {
}
test(name, () async {
- LibraryElement library = await compiler.analyzeUri(file.absolute.uri);
+ var compiler = await newCompiler();
+ await compiler.run(file.absolute.uri);
+ LibraryElement library =
+ await compiler.libraryLoader.loadLibrary(file.absolute.uri);
JavaScriptBackend backend = compiler.backend;
StringBuffer buffer = new StringBuffer();
Program program = backend.kernelTask.buildProgram(library);
@@ -68,3 +71,17 @@ main(List<String> arguments) {
}
}
}
+
+Future<Compiler> newCompiler() async {
+ Compiler compiler = compilerFor(
+ options: [Flags.analyzeOnly, Flags.analyzeAll, Flags.useKernel]);
+ await compiler.setupSdk();
+
+ // The visitor no longer enqueues elements that are not reachable from the
+ // program. The mixin-full resolution transform run by the test expects to
+ // find dart.core::Iterator.
+ var core = await compiler.libraryLoader.loadLibrary(Uri.parse('dart:core'));
+ var cls = core.implementation.localLookup('Iterator');
+ cls.ensureResolved(compiler.resolution);
+ return compiler;
+}
« no previous file with comments | « tests/compiler/dart2js/kernel/class_hierarchy_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698