OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer_cli.test.options; | 5 library analyzer_cli.test.options; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:analyzer_cli/src/driver.dart'; | 9 import 'package:analyzer_cli/src/driver.dart'; |
10 import 'package:analyzer_cli/src/options.dart'; | 10 import 'package:analyzer_cli/src/options.dart'; |
11 import 'package:args/args.dart'; | 11 import 'package:args/args.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 group('CommandLineOptions', () { | 16 group('CommandLineOptions', () { |
17 group('parse', () { | 17 group('parse', () { |
18 test('defaults', () { | 18 test('defaults', () { |
19 CommandLineOptions options = | 19 CommandLineOptions options = |
20 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); | 20 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); |
21 expect(options, isNotNull); | 21 expect(options, isNotNull); |
22 expect(options.buildMode, isFalse); | 22 expect(options.buildMode, isFalse); |
23 expect(options.buildAnalysisOutput, isNull); | 23 expect(options.buildAnalysisOutput, isNull); |
24 expect(options.buildSummaryFallback, isFalse); | |
25 expect(options.buildSummaryInputs, isEmpty); | 24 expect(options.buildSummaryInputs, isEmpty); |
26 expect(options.buildSummaryOnly, isFalse); | 25 expect(options.buildSummaryOnly, isFalse); |
27 expect(options.buildSummaryOutput, isNull); | 26 expect(options.buildSummaryOutput, isNull); |
28 expect(options.buildSummaryOutputSemantic, isNull); | 27 expect(options.buildSummaryOutputSemantic, isNull); |
29 expect(options.buildSuppressExitCode, isFalse); | 28 expect(options.buildSuppressExitCode, isFalse); |
30 expect(options.dartSdkPath, isNotNull); | 29 expect(options.dartSdkPath, isNotNull); |
31 expect(options.disableHints, isFalse); | 30 expect(options.disableHints, isFalse); |
32 expect(options.lints, isFalse); | 31 expect(options.lints, isFalse); |
33 expect(options.displayVersion, isFalse); | 32 expect(options.displayVersion, isFalse); |
34 expect(options.enableStrictCallChecks, isFalse); | 33 expect(options.enableStrictCallChecks, isFalse); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 _parse(['--build-mode', 'package:p/foo.dart|/path/to/p/lib/foo.dart']); | 256 _parse(['--build-mode', 'package:p/foo.dart|/path/to/p/lib/foo.dart']); |
258 expect(options.buildMode, isTrue); | 257 expect(options.buildMode, isTrue); |
259 } | 258 } |
260 | 259 |
261 test_buildMode_allowsEmptyFileList() { | 260 test_buildMode_allowsEmptyFileList() { |
262 _parse(['--build-mode']); | 261 _parse(['--build-mode']); |
263 expect(options.buildMode, isTrue); | 262 expect(options.buildMode, isTrue); |
264 expect(options.sourceFiles, isEmpty); | 263 expect(options.sourceFiles, isEmpty); |
265 } | 264 } |
266 | 265 |
267 test_buildSummaryFallback() { | |
268 _parse([ | |
269 '--build-mode', | |
270 '--build-summary-output=//path/to/output.sum', | |
271 '--build-summary-fallback', | |
272 'package:p/foo.dart|/path/to/p/lib/foo.dart' | |
273 ]); | |
274 expect(options.buildMode, isTrue); | |
275 expect(options.buildSummaryFallback, isTrue); | |
276 } | |
277 | |
278 test_buildSummaryInputs_commaSeparated() { | 266 test_buildSummaryInputs_commaSeparated() { |
279 _parse([ | 267 _parse([ |
280 '--build-mode', | 268 '--build-mode', |
281 '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum', | 269 '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum', |
282 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 270 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
283 ]); | 271 ]); |
284 expect(options.buildMode, isTrue); | 272 expect(options.buildMode, isTrue); |
285 expect( | 273 expect( |
286 options.buildSummaryInputs, ['/path/to/aaa.sum', '/path/to/bbb.sum']); | 274 options.buildSummaryInputs, ['/path/to/aaa.sum', '/path/to/bbb.sum']); |
287 } | 275 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 345 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
358 ]); | 346 ]); |
359 expect(options.buildMode, isTrue); | 347 expect(options.buildMode, isTrue); |
360 expect(options.buildSuppressExitCode, isTrue); | 348 expect(options.buildSuppressExitCode, isTrue); |
361 } | 349 } |
362 | 350 |
363 void _parse(List<String> args) { | 351 void _parse(List<String> args) { |
364 options = CommandLineOptions.parse(args); | 352 options = CommandLineOptions.parse(args); |
365 } | 353 } |
366 } | 354 } |
OLD | NEW |