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

Unified Diff: pkg/analyzer_cli/test/driver_test.dart

Issue 2796953002: Add --build-summary-only-unlinked flag, which makes the output summary be an unlinked summary inste… (Closed)
Patch Set: Created 3 years, 8 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
Index: pkg/analyzer_cli/test/driver_test.dart
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index d5ab1c1956aa41023096467bff92b50b924935b8..81eb70c5e1a0795277a4869d85a83b79751a1d3e 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -14,6 +14,7 @@ import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer_cli/src/ansi.dart' as ansi;
import 'package:analyzer_cli/src/driver.dart';
import 'package:analyzer_cli/src/options.dart';
@@ -412,6 +413,44 @@ linter:
additionalArgs: ['--build-suppress-exit-code']);
expect(exitCode, 0);
});
+
+ test('Linked summary', () async {
+ await withTempDirAsync((tempDir) async {
+ var outputPath = path.join(tempDir, 'test_file.dart.sum');
+ await doDrive(path.join('data', 'test_file.dart'), additionalArgs: [
+ '--build-summary-only',
+ '--build-summary-output=$outputPath'
+ ]);
+ var output = new File(outputPath);
+ expect(output.existsSync(), isTrue);
+ PackageBundle bundle =
+ new PackageBundle.fromBuffer(await output.readAsBytes());
+ var testFileUri = 'file:///test_file.dart';
+ expect(bundle.unlinkedUnitUris, equals([testFileUri]));
+ expect(bundle.linkedLibraryUris, equals([testFileUri]));
+ expect(exitCode, 0);
+ });
+ });
+
+ test('Unlinked summary only', () async {
+ await withTempDirAsync((tempDir) async {
+ var outputPath = path.join(tempDir, 'test_file.dart.sum');
+ await doDrive(path.join('data', 'test_file.dart'), additionalArgs: [
+ '--build-summary-only',
+ '--build-summary-only-unlinked',
+ '--build-summary-output=$outputPath'
+ ]);
+ var output = new File(outputPath);
+ expect(output.existsSync(), isTrue);
+ PackageBundle bundle =
+ new PackageBundle.fromBuffer(await output.readAsBytes());
+ var testFileUri = 'file:///test_file.dart';
+ expect(bundle.unlinkedUnits.length, 1);
+ expect(bundle.unlinkedUnitUris, equals([testFileUri]));
+ expect(bundle.linkedLibraryUris, isEmpty);
+ expect(exitCode, 0);
+ });
+ });
});
}

Powered by Google App Engine
This is Rietveld 408576698