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:test/test.dart'; | 11 import 'package:test/test.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 | 13 |
14 main() { | 14 main() { |
15 group('CommandLineOptions', () { | 15 group('CommandLineOptions', () { |
16 group('parse', () { | 16 group('parse', () { |
17 test('defaults', () { | 17 test('defaults', () { |
18 CommandLineOptions options = | 18 CommandLineOptions options = |
19 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); | 19 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); |
20 expect(options, isNotNull); | 20 expect(options, isNotNull); |
21 expect(options.buildMode, isFalse); | 21 expect(options.buildMode, isFalse); |
22 expect(options.buildAnalysisOutput, isNull); | 22 expect(options.buildAnalysisOutput, isNull); |
23 expect(options.buildSummaryInputs, isEmpty); | 23 expect(options.buildSummaryInputs, isEmpty); |
24 expect(options.buildSummaryOnly, isFalse); | 24 expect(options.buildSummaryOnly, isFalse); |
| 25 expect(options.buildSummaryOnlyDiet, isFalse); |
| 26 expect(options.buildSummaryOnlyUnlinked, isFalse); |
25 expect(options.buildSummaryOutput, isNull); | 27 expect(options.buildSummaryOutput, isNull); |
26 expect(options.buildSummaryOutputSemantic, isNull); | 28 expect(options.buildSummaryOutputSemantic, isNull); |
27 expect(options.buildSuppressExitCode, isFalse); | 29 expect(options.buildSuppressExitCode, isFalse); |
28 expect(options.dartSdkPath, isNotNull); | 30 expect(options.dartSdkPath, isNotNull); |
29 expect(options.disableCacheFlushing, isFalse); | 31 expect(options.disableCacheFlushing, isFalse); |
30 expect(options.disableHints, isFalse); | 32 expect(options.disableHints, isFalse); |
31 expect(options.lints, isFalse); | 33 expect(options.lints, isFalse); |
32 expect(options.displayVersion, isFalse); | 34 expect(options.displayVersion, isFalse); |
33 expect(options.enableStrictCallChecks, isFalse); | 35 expect(options.enableStrictCallChecks, isFalse); |
34 expect(options.enableSuperMixins, isFalse); | 36 expect(options.enableSuperMixins, isFalse); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 _parse([ | 301 _parse([ |
300 '--build-mode', | 302 '--build-mode', |
301 '--build-summary-output=/path/to/aaa.sum', | 303 '--build-summary-output=/path/to/aaa.sum', |
302 '--build-summary-only', | 304 '--build-summary-only', |
303 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 305 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
304 ]); | 306 ]); |
305 expect(options.buildMode, isTrue); | 307 expect(options.buildMode, isTrue); |
306 expect(options.buildSummaryOnly, isTrue); | 308 expect(options.buildSummaryOnly, isTrue); |
307 } | 309 } |
308 | 310 |
| 311 test_buildSummaryOnlyDiet() { |
| 312 _parse([ |
| 313 '--build-mode', |
| 314 '--build-summary-output=/path/to/aaa.sum', |
| 315 '--build-summary-only', |
| 316 '--build-summary-only-diet', |
| 317 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 318 ]); |
| 319 expect(options.buildMode, isTrue); |
| 320 expect(options.buildSummaryOnly, isTrue); |
| 321 expect(options.buildSummaryOnlyDiet, isTrue); |
| 322 } |
| 323 |
| 324 test_buildSummaryOnlyUnlinked() { |
| 325 _parse([ |
| 326 '--build-mode', |
| 327 '--build-summary-output=/path/to/aaa.sum', |
| 328 '--build-summary-only', |
| 329 '--build-summary-only-unlinked', |
| 330 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 331 ]); |
| 332 expect(options.buildMode, isTrue); |
| 333 expect(options.buildSummaryOnly, isTrue); |
| 334 expect(options.buildSummaryOnlyUnlinked, isTrue); |
| 335 } |
| 336 |
309 test_buildSummaryOutput() { | 337 test_buildSummaryOutput() { |
310 _parse([ | 338 _parse([ |
311 '--build-mode', | 339 '--build-mode', |
312 '--build-summary-output=//path/to/output.sum', | 340 '--build-summary-output=//path/to/output.sum', |
313 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 341 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
314 ]); | 342 ]); |
315 expect(options.buildMode, isTrue); | 343 expect(options.buildMode, isTrue); |
316 expect(options.buildSummaryOutput, '//path/to/output.sum'); | 344 expect(options.buildSummaryOutput, '//path/to/output.sum'); |
317 } | 345 } |
318 | 346 |
(...skipping 14 matching lines...) Expand all Loading... |
333 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 361 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
334 ]); | 362 ]); |
335 expect(options.buildMode, isTrue); | 363 expect(options.buildMode, isTrue); |
336 expect(options.buildSuppressExitCode, isTrue); | 364 expect(options.buildSuppressExitCode, isTrue); |
337 } | 365 } |
338 | 366 |
339 void _parse(List<String> args) { | 367 void _parse(List<String> args) { |
340 options = CommandLineOptions.parse(args); | 368 options = CommandLineOptions.parse(args); |
341 } | 369 } |
342 } | 370 } |
OLD | NEW |