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

Side by Side Diff: pkg/front_end/test/src/base/processed_options_test.dart

Issue 2999563002: Add support for SDK outline in IKG. (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/compiler_options.dart'; 7 import 'package:front_end/compiler_options.dart';
8 import 'package:front_end/memory_file_system.dart'; 8 import 'package:front_end/memory_file_system.dart';
9 import 'package:front_end/src/base/processed_options.dart'; 9 import 'package:front_end/src/base/processed_options.dart';
10 import 'package:front_end/src/fasta/compiler_context.dart';
10 import 'package:front_end/src/fasta/fasta.dart' show ByteSink; 11 import 'package:front_end/src/fasta/fasta.dart' show ByteSink;
11 import 'package:front_end/src/fasta/compiler_context.dart';
12 import 'package:front_end/src/fasta/fasta_codes.dart'; 12 import 'package:front_end/src/fasta/fasta_codes.dart';
13 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter; 13 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
14 import 'package:kernel/kernel.dart' show Program, Library, CanonicalName; 14 import 'package:kernel/kernel.dart'
15 show CanonicalName, Library, Program, loadProgramFromBytes;
15 import 'package:package_config/packages.dart' show Packages; 16 import 'package:package_config/packages.dart' show Packages;
16
17 import 'package:test/test.dart'; 17 import 'package:test/test.dart';
18 import 'package:test_reflective_loader/test_reflective_loader.dart'; 18 import 'package:test_reflective_loader/test_reflective_loader.dart';
19 19
20 main() { 20 main() {
21 CompilerContext.runWithDefaultOptions((_) { 21 CompilerContext.runWithDefaultOptions((_) {
22 defineReflectiveSuite(() { 22 defineReflectiveSuite(() {
23 defineReflectiveTests(ProcessedOptionsTest); 23 defineReflectiveTests(ProcessedOptionsTest);
24 }); 24 });
25 }); 25 });
26 } 26 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 60
61 test_fileSystem_noBazelRoots() { 61 test_fileSystem_noBazelRoots() {
62 // When no bazel roots are specified, the filesystem should be passed 62 // When no bazel roots are specified, the filesystem should be passed
63 // through unmodified. 63 // through unmodified.
64 var raw = new CompilerOptions()..fileSystem = fileSystem; 64 var raw = new CompilerOptions()..fileSystem = fileSystem;
65 var processed = new ProcessedOptions(raw); 65 var processed = new ProcessedOptions(raw);
66 expect(processed.fileSystem, same(fileSystem)); 66 expect(processed.fileSystem, same(fileSystem));
67 } 67 }
68 68
69 test_getSdkSummaryBytes_summaryLocationProvided() async {
70 var uri = Uri.parse('file:///sdkSummary');
71
72 writeMockSummaryTo(uri);
73
74 var raw = new CompilerOptions()
75 ..fileSystem = fileSystem
76 ..sdkSummary = uri;
77 var processed = new ProcessedOptions(raw);
78
79 var bytes = await processed.loadSdkSummaryBytes();
80 expect(bytes, isNotEmpty);
81
82 var sdkSummary = loadProgramFromBytes(bytes);
83 expect(sdkSummary.libraries.single.importUri,
84 mockSummary.libraries.single.importUri);
85 }
86
69 test_getSdkSummary_summaryLocationProvided() async { 87 test_getSdkSummary_summaryLocationProvided() async {
70 var uri = Uri.parse('file:///sdkSummary'); 88 var uri = Uri.parse('file:///sdkSummary');
71 writeMockSummaryTo(uri); 89 writeMockSummaryTo(uri);
72 checkMockSummary(new CompilerOptions() 90 checkMockSummary(new CompilerOptions()
73 ..fileSystem = fileSystem 91 ..fileSystem = fileSystem
74 ..sdkSummary = uri); 92 ..sdkSummary = uri);
75 } 93 }
76 94
77 void writeMockSummaryTo(Uri uri) { 95 void writeMockSummaryTo(Uri uri) {
78 var sink = new ByteSink(); 96 var sink = new ByteSink();
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 var index = messageTemplate.indexOf('#'); 464 var index = messageTemplate.indexOf('#');
447 var prefix = messageTemplate.substring(0, index - 1); 465 var prefix = messageTemplate.substring(0, index - 1);
448 466
449 // Check that the prefix is not empty and that it contains more than one 467 // Check that the prefix is not empty and that it contains more than one
450 // word. 468 // word.
451 expect(prefix.length > 0, isTrue); 469 expect(prefix.length > 0, isTrue);
452 expect(prefix.contains(' '), isTrue); 470 expect(prefix.contains(' '), isTrue);
453 return prefix; 471 return prefix;
454 } 472 }
455 } 473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698