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:analyzer/src/summary/format.dart'; | 7 import 'package:analyzer/src/summary/format.dart'; |
8 import 'package:front_end/compiler_options.dart'; | 8 import 'package:front_end/compiler_options.dart'; |
9 import 'package:front_end/memory_file_system.dart'; | 9 import 'package:front_end/memory_file_system.dart'; |
10 import 'package:front_end/src/base/processed_options.dart'; | 10 import 'package:front_end/src/base/processed_options.dart'; |
11 import 'package:path/path.dart' as pathos; | |
12 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
14 | 13 |
15 main() { | 14 main() { |
16 defineReflectiveSuite(() { | 15 defineReflectiveSuite(() { |
17 defineReflectiveTests(ProcessedOptionsTest); | 16 defineReflectiveTests(ProcessedOptionsTest); |
18 }); | 17 }); |
19 } | 18 } |
20 | 19 |
21 @reflectiveTest | 20 @reflectiveTest |
22 class ProcessedOptionsTest { | 21 class ProcessedOptionsTest { |
23 final fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///')); | 22 final fileSystem = new MemoryFileSystem(Uri.parse('file:///')); |
24 | 23 |
25 PackageBundleBuilder _mockSdkSummary; | 24 PackageBundleBuilder _mockSdkSummary; |
26 | 25 |
27 PackageBundleBuilder get mockSdkSummary => _mockSdkSummary ??= | 26 PackageBundleBuilder get mockSdkSummary => _mockSdkSummary ??= |
28 new PackageBundleBuilder(apiSignature: 'mock summary signature'); | 27 new PackageBundleBuilder(apiSignature: 'mock summary signature'); |
29 | 28 |
30 Future<Null> checkMockSummary(CompilerOptions raw) async { | 29 Future<Null> checkMockSummary(CompilerOptions raw) async { |
31 var processed = new ProcessedOptions(raw); | 30 var processed = new ProcessedOptions(raw); |
32 var sdkSummary = await processed.getSdkSummary(); | 31 var sdkSummary = await processed.getSdkSummary(); |
33 expect(sdkSummary.apiSignature, mockSdkSummary.apiSignature); | 32 expect(sdkSummary.apiSignature, mockSdkSummary.apiSignature); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ..packagesFileUri = new Uri(); | 126 ..packagesFileUri = new Uri(); |
128 var processed = new ProcessedOptions(raw); | 127 var processed = new ProcessedOptions(raw); |
129 var uriResolver = await processed.getUriResolver(); | 128 var uriResolver = await processed.getUriResolver(); |
130 expect(uriResolver.packages, isEmpty); | 129 expect(uriResolver.packages, isEmpty); |
131 } | 130 } |
132 | 131 |
133 void writeMockSummaryTo(Uri uri) { | 132 void writeMockSummaryTo(Uri uri) { |
134 fileSystem.entityForUri(uri).writeAsBytesSync(mockSdkSummary.toBuffer()); | 133 fileSystem.entityForUri(uri).writeAsBytesSync(mockSdkSummary.toBuffer()); |
135 } | 134 } |
136 } | 135 } |
OLD | NEW |