| 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/fasta.dart' show ByteSink; | 10 import 'package:front_end/src/fasta/fasta.dart' show ByteSink; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 test_validateOptions_root_doesnt_exists() async { | 156 test_validateOptions_root_doesnt_exists() async { |
| 157 var sdkRoot = Uri.parse('file:///sdk/root'); | 157 var sdkRoot = Uri.parse('file:///sdk/root'); |
| 158 var errors = []; | 158 var errors = []; |
| 159 var raw = new CompilerOptions() | 159 var raw = new CompilerOptions() |
| 160 ..sdkRoot = sdkRoot | 160 ..sdkRoot = sdkRoot |
| 161 ..fileSystem = fileSystem | 161 ..fileSystem = fileSystem |
| 162 ..onError = (e) => errors.add(e); | 162 ..onError = (e) => errors.add(e); |
| 163 var options = new ProcessedOptions(raw); | 163 var options = new ProcessedOptions(raw); |
| 164 expect(await options.validateOptions(), isFalse); | 164 expect(await options.validateOptions(), isFalse); |
| 165 expect('${errors.first}', contains("SDK root directory not found")); | 165 expect(errors.first.message, contains("SDK root directory not found")); |
| 166 } | 166 } |
| 167 | 167 |
| 168 test_validateOptions_summary_exists() async { | 168 test_validateOptions_summary_exists() async { |
| 169 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); | 169 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); |
| 170 fileSystem.entityForUri(sdkSummary).writeAsStringSync('\n'); | 170 fileSystem.entityForUri(sdkSummary).writeAsStringSync('\n'); |
| 171 | 171 |
| 172 var errors = []; | 172 var errors = []; |
| 173 var raw = new CompilerOptions() | 173 var raw = new CompilerOptions() |
| 174 ..sdkSummary = sdkSummary | 174 ..sdkSummary = sdkSummary |
| 175 ..fileSystem = fileSystem | 175 ..fileSystem = fileSystem |
| 176 ..onError = (e) => errors.add(e); | 176 ..onError = (e) => errors.add(e); |
| 177 var options = new ProcessedOptions(raw); | 177 var options = new ProcessedOptions(raw); |
| 178 var result = await options.validateOptions(); | 178 var result = await options.validateOptions(); |
| 179 expect(errors, isEmpty); | 179 expect(errors, isEmpty); |
| 180 expect(result, isTrue); | 180 expect(result, isTrue); |
| 181 } | 181 } |
| 182 | 182 |
| 183 test_validateOptions_summary_doesnt_exists() async { | 183 test_validateOptions_summary_doesnt_exists() async { |
| 184 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); | 184 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); |
| 185 var errors = []; | 185 var errors = []; |
| 186 var raw = new CompilerOptions() | 186 var raw = new CompilerOptions() |
| 187 ..sdkSummary = sdkSummary | 187 ..sdkSummary = sdkSummary |
| 188 ..fileSystem = fileSystem | 188 ..fileSystem = fileSystem |
| 189 ..onError = (e) => errors.add(e); | 189 ..onError = (e) => errors.add(e); |
| 190 var options = new ProcessedOptions(raw); | 190 var options = new ProcessedOptions(raw); |
| 191 expect(await options.validateOptions(), isFalse); | 191 expect(await options.validateOptions(), isFalse); |
| 192 expect('${errors.first}', contains("SDK summary not found")); | 192 expect(errors.first.message, contains("SDK summary not found")); |
| 193 } | 193 } |
| 194 | 194 |
| 195 test_validateOptions_inferred_summary_exists() async { | 195 test_validateOptions_inferred_summary_exists() async { |
| 196 var sdkRoot = Uri.parse('file:///sdk/root/'); | 196 var sdkRoot = Uri.parse('file:///sdk/root/'); |
| 197 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); | 197 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); |
| 198 fileSystem.entityForUri(sdkRoot).writeAsStringSync('\n'); | 198 fileSystem.entityForUri(sdkRoot).writeAsStringSync('\n'); |
| 199 fileSystem.entityForUri(sdkSummary).writeAsStringSync('\n'); | 199 fileSystem.entityForUri(sdkSummary).writeAsStringSync('\n'); |
| 200 | 200 |
| 201 var errors = []; | 201 var errors = []; |
| 202 var raw = new CompilerOptions() | 202 var raw = new CompilerOptions() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 213 var sdkRoot = Uri.parse('file:///sdk/root/'); | 213 var sdkRoot = Uri.parse('file:///sdk/root/'); |
| 214 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); | 214 var sdkSummary = Uri.parse('file:///sdk/root/outline.dill'); |
| 215 fileSystem.entityForUri(sdkRoot).writeAsStringSync('\n'); | 215 fileSystem.entityForUri(sdkRoot).writeAsStringSync('\n'); |
| 216 var errors = []; | 216 var errors = []; |
| 217 var raw = new CompilerOptions() | 217 var raw = new CompilerOptions() |
| 218 ..sdkSummary = sdkSummary | 218 ..sdkSummary = sdkSummary |
| 219 ..fileSystem = fileSystem | 219 ..fileSystem = fileSystem |
| 220 ..onError = (e) => errors.add(e); | 220 ..onError = (e) => errors.add(e); |
| 221 var options = new ProcessedOptions(raw); | 221 var options = new ProcessedOptions(raw); |
| 222 expect(await options.validateOptions(), isFalse); | 222 expect(await options.validateOptions(), isFalse); |
| 223 expect('${errors.first}', contains("SDK summary not found")); | 223 expect(errors.first.message, contains("SDK summary not found")); |
| 224 } | 224 } |
| 225 } | 225 } |
| OLD | NEW |