| 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.buildSummaryInputs, isEmpty); | 25 expect(options.buildSummaryInputs, isEmpty); |
| 25 expect(options.buildSummaryOnly, isFalse); | 26 expect(options.buildSummaryOnly, isFalse); |
| 26 expect(options.buildSummaryOutput, isNull); | 27 expect(options.buildSummaryOutput, isNull); |
| 27 expect(options.buildSuppressExitCode, isFalse); | 28 expect(options.buildSuppressExitCode, isFalse); |
| 28 expect(options.dartSdkPath, isNotNull); | 29 expect(options.dartSdkPath, isNotNull); |
| 29 expect(options.disableHints, isFalse); | 30 expect(options.disableHints, isFalse); |
| 30 expect(options.lints, isFalse); | 31 expect(options.lints, isFalse); |
| 31 expect(options.displayVersion, isFalse); | 32 expect(options.displayVersion, isFalse); |
| 32 expect(options.enableStrictCallChecks, isFalse); | 33 expect(options.enableStrictCallChecks, isFalse); |
| 33 expect(options.enableSuperMixins, isFalse); | 34 expect(options.enableSuperMixins, isFalse); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ]); | 244 ]); |
| 244 expect(options.buildMode, isTrue); | 245 expect(options.buildMode, isTrue); |
| 245 expect(options.buildAnalysisOutput, '//path/to/output.analysis'); | 246 expect(options.buildAnalysisOutput, '//path/to/output.analysis'); |
| 246 } | 247 } |
| 247 | 248 |
| 248 test_buildMode() { | 249 test_buildMode() { |
| 249 _parse(['--build-mode', 'package:p/foo.dart|/path/to/p/lib/foo.dart']); | 250 _parse(['--build-mode', 'package:p/foo.dart|/path/to/p/lib/foo.dart']); |
| 250 expect(options.buildMode, isTrue); | 251 expect(options.buildMode, isTrue); |
| 251 } | 252 } |
| 252 | 253 |
| 254 test_buildSummaryFallback() { |
| 255 _parse([ |
| 256 '--build-mode', |
| 257 '--build-summary-output=//path/to/output.sum', |
| 258 '--build-summary-fallback', |
| 259 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 260 ]); |
| 261 expect(options.buildMode, isTrue); |
| 262 expect(options.buildSummaryFallback, isTrue); |
| 263 } |
| 264 |
| 253 test_buildSummaryInputs_commaSeparated() { | 265 test_buildSummaryInputs_commaSeparated() { |
| 254 _parse([ | 266 _parse([ |
| 255 '--build-mode', | 267 '--build-mode', |
| 256 '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum', | 268 '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum', |
| 257 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 269 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 258 ]); | 270 ]); |
| 259 expect(options.buildMode, isTrue); | 271 expect(options.buildMode, isTrue); |
| 260 expect( | 272 expect( |
| 261 options.buildSummaryInputs, ['/path/to/aaa.sum', '/path/to/bbb.sum']); | 273 options.buildSummaryInputs, ['/path/to/aaa.sum', '/path/to/bbb.sum']); |
| 262 } | 274 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 313 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
| 302 ]); | 314 ]); |
| 303 expect(options.buildMode, isTrue); | 315 expect(options.buildMode, isTrue); |
| 304 expect(options.buildSuppressExitCode, isTrue); | 316 expect(options.buildSuppressExitCode, isTrue); |
| 305 } | 317 } |
| 306 | 318 |
| 307 void _parse(List<String> args) { | 319 void _parse(List<String> args) { |
| 308 options = CommandLineOptions.parse(args); | 320 options = CommandLineOptions.parse(args); |
| 309 } | 321 } |
| 310 } | 322 } |
| OLD | NEW |