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

Unified Diff: pkg/front_end/test/incremental_kernel_generator_test.dart

Issue 2989223002: Pass additional options in incremental setup (Closed)
Patch Set: fix test Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/lib/incremental_kernel_generator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/incremental_kernel_generator_test.dart
diff --git a/pkg/front_end/test/incremental_kernel_generator_test.dart b/pkg/front_end/test/incremental_kernel_generator_test.dart
index 2bb21d0d6125ab37fb18d6301be349ddbe12188a..9195343d6e309c864bc6d5a78f016df518e07ab6 100644
--- a/pkg/front_end/test/incremental_kernel_generator_test.dart
+++ b/pkg/front_end/test/incremental_kernel_generator_test.dart
@@ -34,7 +34,8 @@ class IncrementalKernelGeneratorTest {
IncrementalKernelGeneratorImpl incrementalKernelGenerator;
/// Compute the initial [Program] for the given [entryPoint].
- Future<Program> getInitialState(Uri entryPoint) async {
+ Future<Program> getInitialState(Uri entryPoint,
+ {bool setPackages: true}) async {
Map<String, Uri> dartLibraries = createSdkFiles(fileSystem);
// TODO(scheglov) Builder the SDK kernel and set it into the options.
@@ -46,8 +47,11 @@ class IncrementalKernelGeneratorTest {
// ..logger = new PerformanceLog(stdout)
..strongMode = true
..chaseDependencies = true
- ..dartLibraries = dartLibraries
- ..packagesFileUri = Uri.parse('file:///test/.packages');
+ ..dartLibraries = dartLibraries;
+
+ if (setPackages) {
+ compilerOptions.packagesFileUri = Uri.parse('file:///test/.packages');
+ }
incrementalKernelGenerator = await IncrementalKernelGenerator
.newInstance(compilerOptions, entryPoint, watch: watchFn);
return (await incrementalKernelGenerator.computeDelta()).newProgram;
@@ -230,6 +234,30 @@ static method main() → dynamic {
}
}
+ test_inferPackagesFile() async {
+ writeFile('/test/.packages', 'test:lib/');
+ String aPath = '/test/lib/a.dart';
+ String bPath = '/test/lib/b.dart';
+ writeFile(aPath, 'var a = 1;');
+ Uri bUri = writeFile(bPath, r'''
+import "package:test/a.dart";
+var b = a;
+''');
+
+ // Ensures that the `.packages` file can be discovered automatically
+ // from the entry point file.
+ Program program = await getInitialState(bUri, setPackages: false);
+ Library library = _getLibrary(program, bUri);
+ expect(_getLibraryText(library), r'''
+library;
+import self as self;
+import "dart:core" as core;
+import "package:test/a.dart" as a;
+
+static field core::int b = a::a;
+''');
+ }
+
test_watch() async {
writeFile('/test/.packages', 'test:lib/');
String aPath = '/test/lib/a.dart';
« no previous file with comments | « pkg/front_end/lib/incremental_kernel_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698