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

Unified Diff: pkg/front_end/test/src/base/processed_options_test.dart

Issue 2894273002: Revert "First step for modular output in fasta." (Closed)
Patch Set: Created 3 years, 7 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/test/fasta/testing/suite.dart ('k') | pkg/front_end/test/subpackage_relationships_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/test/src/base/processed_options_test.dart
diff --git a/pkg/front_end/test/src/base/processed_options_test.dart b/pkg/front_end/test/src/base/processed_options_test.dart
index 365c5f2ce5d38e4f63bc1abeee6fd284a79f5ca3..e968c8abbe69d8774b3e99bac18b3799da3a8f7f 100644
--- a/pkg/front_end/test/src/base/processed_options_test.dart
+++ b/pkg/front_end/test/src/base/processed_options_test.dart
@@ -4,13 +4,10 @@
import 'dart:async';
+import 'package:analyzer/src/summary/format.dart';
import 'package:front_end/compiler_options.dart';
import 'package:front_end/memory_file_system.dart';
import 'package:front_end/src/base/processed_options.dart';
-import 'package:front_end/src/fasta/fasta.dart' show ByteSink;
-import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
-import 'package:kernel/kernel.dart' show Program, Library;
-
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -24,10 +21,16 @@ main() {
class ProcessedOptionsTest {
final fileSystem = new MemoryFileSystem(Uri.parse('file:///'));
- Program _mockOutline;
+ PackageBundleBuilder _mockSdkSummary;
- Program get mockSummary => _mockOutline ??=
- new Program(libraries: [new Library(Uri.parse('file:///a/b.dart'))]);
+ PackageBundleBuilder get mockSdkSummary => _mockSdkSummary ??=
+ new PackageBundleBuilder(apiSignature: 'mock summary signature');
+
+ Future<Null> checkMockSummary(CompilerOptions raw) async {
+ var processed = new ProcessedOptions(raw);
+ var sdkSummary = await processed.getSdkSummary();
+ expect(sdkSummary.apiSignature, mockSdkSummary.apiSignature);
+ }
test_compileSdk_false() {
for (var value in [false, true]) {
@@ -45,25 +48,37 @@ class ProcessedOptionsTest {
expect(processed.fileSystem, same(fileSystem));
}
- test_getSdkSummary_summaryLocationProvided() async {
- var uri = Uri.parse('file:///sdkSummary');
- writeMockSummaryTo(uri);
+ test_getSdkSummary_sdkLocationProvided_noTrailingSlash() async {
+ var uri = Uri.parse('file:///sdk');
+ writeMockSummaryTo(Uri.parse('$uri/lib/_internal/strong.sum'));
checkMockSummary(new CompilerOptions()
..fileSystem = fileSystem
- ..sdkSummary = uri);
+ ..sdkRoot = uri);
}
- void writeMockSummaryTo(Uri uri) {
- var sink = new ByteSink();
- new BinaryPrinter(sink).writeProgramFile(mockSummary);
- fileSystem.entityForUri(uri).writeAsBytesSync(sink.builder.takeBytes());
+ test_getSdkSummary_sdkLocationProvided_spec() async {
+ var uri = Uri.parse('file:///sdk');
+ writeMockSummaryTo(Uri.parse('$uri/lib/_internal/spec.sum'));
+ checkMockSummary(new CompilerOptions()
+ ..fileSystem = fileSystem
+ ..strongMode = false
+ ..sdkRoot = uri);
}
- Future<Null> checkMockSummary(CompilerOptions raw) async {
- var processed = new ProcessedOptions(raw);
- var sdkSummary = await processed.sdkSummaryProgram;
- expect(sdkSummary.libraries.single.importUri,
- mockSummary.libraries.single.importUri);
+ test_getSdkSummary_sdkLocationProvided_trailingSlash() async {
+ var uri = Uri.parse('file:///sdk');
+ writeMockSummaryTo(Uri.parse('$uri/lib/_internal/strong.sum'));
+ checkMockSummary(new CompilerOptions()
+ ..fileSystem = fileSystem
+ ..sdkRoot = Uri.parse('$uri/'));
+ }
+
+ test_getSdkSummary_summaryLocationProvided() async {
+ var uri = Uri.parse('file:///sdkSummary');
+ writeMockSummaryTo(uri);
+ checkMockSummary(new CompilerOptions()
+ ..fileSystem = fileSystem
+ ..sdkSummary = uri);
}
test_getUriTranslator_explicitPackagesFile() async {
@@ -113,4 +128,8 @@ class ProcessedOptionsTest {
var uriTranslator = await processed.getUriTranslator();
expect(uriTranslator.packages, isEmpty);
}
+
+ void writeMockSummaryTo(Uri uri) {
+ fileSystem.entityForUri(uri).writeAsBytesSync(mockSdkSummary.toBuffer());
+ }
}
« no previous file with comments | « pkg/front_end/test/fasta/testing/suite.dart ('k') | pkg/front_end/test/subpackage_relationships_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698