| 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); | 24 expect(options.buildSummaryFallback, isFalse); |
| 25 expect(options.buildSummaryInputs, isEmpty); | 25 expect(options.buildSummaryInputs, isEmpty); |
| 26 expect(options.buildSummaryOnly, isFalse); | 26 expect(options.buildSummaryOnly, isFalse); |
| 27 expect(options.buildSummaryOutput, isNull); | 27 expect(options.buildSummaryOutput, isNull); |
| 28 expect(options.buildSummaryOutputSemantic, isNull); |
| 28 expect(options.buildSuppressExitCode, isFalse); | 29 expect(options.buildSuppressExitCode, isFalse); |
| 29 expect(options.dartSdkPath, isNotNull); | 30 expect(options.dartSdkPath, isNotNull); |
| 30 expect(options.disableHints, isFalse); | 31 expect(options.disableHints, isFalse); |
| 31 expect(options.lints, isFalse); | 32 expect(options.lints, isFalse); |
| 32 expect(options.displayVersion, isFalse); | 33 expect(options.displayVersion, isFalse); |
| 33 expect(options.enableStrictCallChecks, isFalse); | 34 expect(options.enableStrictCallChecks, isFalse); |
| 34 expect(options.enableSuperMixins, isFalse); | 35 expect(options.enableSuperMixins, isFalse); |
| 35 expect(options.enableTypeChecks, isFalse); | 36 expect(options.enableTypeChecks, isFalse); |
| 36 expect(options.hintsAreFatal, isFalse); | 37 expect(options.hintsAreFatal, isFalse); |
| 37 expect(options.ignoreUnrecognizedFlags, isFalse); | 38 expect(options.ignoreUnrecognizedFlags, isFalse); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 test_buildSummaryOutput() { | 312 test_buildSummaryOutput() { |
| 312 _parse([ | 313 _parse([ |
| 313 '--build-mode', | 314 '--build-mode', |
| 314 '--build-summary-output=//path/to/output.sum', | 315 '--build-summary-output=//path/to/output.sum', |
| 315 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 316 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 316 ]); | 317 ]); |
| 317 expect(options.buildMode, isTrue); | 318 expect(options.buildMode, isTrue); |
| 318 expect(options.buildSummaryOutput, '//path/to/output.sum'); | 319 expect(options.buildSummaryOutput, '//path/to/output.sum'); |
| 319 } | 320 } |
| 320 | 321 |
| 322 test_buildSummaryOutputSemantic() { |
| 323 _parse([ |
| 324 '--build-mode', |
| 325 '--build-summary-output-semantic=//path/to/output.sum', |
| 326 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 327 ]); |
| 328 expect(options.buildMode, isTrue); |
| 329 expect(options.buildSummaryOutputSemantic, '//path/to/output.sum'); |
| 330 } |
| 331 |
| 321 test_buildSuppressExitCode() { | 332 test_buildSuppressExitCode() { |
| 322 _parse([ | 333 _parse([ |
| 323 '--build-mode', | 334 '--build-mode', |
| 324 '--build-suppress-exit-code', | 335 '--build-suppress-exit-code', |
| 325 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 336 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 326 ]); | 337 ]); |
| 327 expect(options.buildMode, isTrue); | 338 expect(options.buildMode, isTrue); |
| 328 expect(options.buildSuppressExitCode, isTrue); | 339 expect(options.buildSuppressExitCode, isTrue); |
| 329 } | 340 } |
| 330 | 341 |
| 331 void _parse(List<String> args) { | 342 void _parse(List<String> args) { |
| 332 options = CommandLineOptions.parse(args); | 343 options = CommandLineOptions.parse(args); |
| 333 } | 344 } |
| 334 } | 345 } |
| OLD | NEW |