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

Unified Diff: pkg/front_end/test/fasta/shaker_test.dart

Issue 3011663002: Restructure outline shaker 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/testcases/shaker/classes_in_signatures.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/fasta/shaker_test.dart
diff --git a/pkg/front_end/test/fasta/shaker_test.dart b/pkg/front_end/test/fasta/shaker_test.dart
index 7032f47c7d59494ef59e78ec24510b7dbf5040d2..5744489b64bbc505d2c64884da83a4f6a6d35714 100644
--- a/pkg/front_end/test/fasta/shaker_test.dart
+++ b/pkg/front_end/test/fasta/shaker_test.dart
@@ -108,14 +108,12 @@ class BuildProgram
await dillTarget.buildOutlines();
var inputUri = description.uri;
- var libUri = inputUri.resolve('lib/lib.dart');
- sourceTarget.read(libUri);
sourceTarget.read(inputUri);
var contents = new File.fromUri(inputUri).readAsStringSync();
var showCoreLibraries = contents.contains("@@SHOW_CORE_LIBRARIES@@");
await sourceTarget.buildOutlines();
var program = await sourceTarget.buildProgram();
- bool isIncluded(Uri uri) => !_isTreeShaken(uri);
+ bool isIncluded(Uri uri) => uri == inputUri;
trimProgram(program, isIncluded);
return pass(
new _IntermediateData(inputUri, program, showCoreLibraries));
@@ -168,7 +166,7 @@ class CheckShaker extends Step<_IntermediateData, String, ChainContext> {
buffer.writeln('Tree-shaker preserved the following:');
for (var library in program.libraries) {
var importUri = library.importUri;
- if (!_isTreeShaken(importUri)) continue;
+ if (importUri == entryUri) continue;
if (importUri.isScheme('dart') && !data.showCoreLibraries) continue;
String uri = relativizeUri(library.importUri);
buffer.writeln('\nlibrary $uri:');
@@ -217,12 +215,3 @@ $buffer""");
}
}
}
-
-/// A special library used only to test the shaker. The suite above will
-/// tree-shake the contents of this library.
-const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart';
-
-/// Tree-shake dart:* libraries and the library under [_specialLibraryPath].
-bool _isTreeShaken(Uri uri) =>
- uri.isScheme('dart') ||
- Uri.base.resolveUri(uri).path.endsWith(_specialLibraryPath);
« no previous file with comments | « no previous file | pkg/front_end/testcases/shaker/classes_in_signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698