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); |
+ }); |
+ }); |
}); |
} |