| OLD | NEW |
| 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/compiler_context.dart'; |
| 11 import 'package:front_end/src/fasta/fasta.dart' show ByteSink; | 11 import 'package:front_end/src/fasta/util/bytes_sink.dart' show BytesSink; |
| 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' | 14 import 'package:kernel/kernel.dart' |
| 15 show CanonicalName, Library, Program, loadProgramFromBytes; | 15 show CanonicalName, Library, Program, loadProgramFromBytes; |
| 16 import 'package:package_config/packages.dart' show Packages; | 16 import 'package:package_config/packages.dart' show Packages; |
| 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((_) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 test_getSdkSummary_summaryLocationProvided() async { | 87 test_getSdkSummary_summaryLocationProvided() async { |
| 88 var uri = Uri.parse('file:///sdkSummary'); | 88 var uri = Uri.parse('file:///sdkSummary'); |
| 89 writeMockSummaryTo(uri); | 89 writeMockSummaryTo(uri); |
| 90 checkMockSummary(new CompilerOptions() | 90 checkMockSummary(new CompilerOptions() |
| 91 ..fileSystem = fileSystem | 91 ..fileSystem = fileSystem |
| 92 ..sdkSummary = uri); | 92 ..sdkSummary = uri); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void writeMockSummaryTo(Uri uri) { | 95 void writeMockSummaryTo(Uri uri) { |
| 96 var sink = new ByteSink(); | 96 var sink = new BytesSink(); |
| 97 new BinaryPrinter(sink).writeProgramFile(mockSummary); | 97 new BinaryPrinter(sink).writeProgramFile(mockSummary); |
| 98 fileSystem.entityForUri(uri).writeAsBytesSync(sink.builder.takeBytes()); | 98 fileSystem.entityForUri(uri).writeAsBytesSync(sink.builder.takeBytes()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 Future<Null> checkMockSummary(CompilerOptions raw) async { | 101 Future<Null> checkMockSummary(CompilerOptions raw) async { |
| 102 var processed = new ProcessedOptions(raw); | 102 var processed = new ProcessedOptions(raw); |
| 103 var sdkSummary = await processed.loadSdkSummary(new CanonicalName.root()); | 103 var sdkSummary = await processed.loadSdkSummary(new CanonicalName.root()); |
| 104 expect(sdkSummary.libraries.single.importUri, | 104 expect(sdkSummary.libraries.single.importUri, |
| 105 mockSummary.libraries.single.importUri); | 105 mockSummary.libraries.single.importUri); |
| 106 } | 106 } |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 var index = messageTemplate.indexOf('#'); | 464 var index = messageTemplate.indexOf('#'); |
| 465 var prefix = messageTemplate.substring(0, index - 1); | 465 var prefix = messageTemplate.substring(0, index - 1); |
| 466 | 466 |
| 467 // 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 |
| 468 // word. | 468 // word. |
| 469 expect(prefix.length > 0, isTrue); | 469 expect(prefix.length > 0, isTrue); |
| 470 expect(prefix.contains(' '), isTrue); | 470 expect(prefix.contains(' '), isTrue); |
| 471 return prefix; | 471 return prefix; |
| 472 } | 472 } |
| 473 } | 473 } |
| OLD | NEW |