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.buildSummaryInputs, isEmpty); | 24 expect(options.buildSummaryInputs, isEmpty); |
25 expect(options.buildSummaryOnly, isFalse); | 25 expect(options.buildSummaryOnly, isFalse); |
26 expect(options.buildSummaryOutput, isNull); | 26 expect(options.buildSummaryOutput, isNull); |
27 expect(options.buildSummaryOutputSemantic, isNull); | 27 expect(options.buildSummaryOutputSemantic, isNull); |
28 expect(options.buildSuppressExitCode, isFalse); | 28 expect(options.buildSuppressExitCode, isFalse); |
29 expect(options.dartSdkPath, isNotNull); | 29 expect(options.dartSdkPath, isNotNull); |
| 30 expect(options.disableCacheFlushing, isFalse); |
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); |
38 expect(options.log, isFalse); | 39 expect(options.log, isFalse); |
39 expect(options.machineFormat, isFalse); | 40 expect(options.machineFormat, isFalse); |
(...skipping 13 matching lines...) Expand all Loading... |
53 expect(options.shouldBatch, isTrue); | 54 expect(options.shouldBatch, isTrue); |
54 }); | 55 }); |
55 | 56 |
56 test('defined variables', () { | 57 test('defined variables', () { |
57 CommandLineOptions options = CommandLineOptions | 58 CommandLineOptions options = CommandLineOptions |
58 .parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']); | 59 .parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']); |
59 expect(options.definedVariables['foo'], equals('bar')); | 60 expect(options.definedVariables['foo'], equals('bar')); |
60 expect(options.definedVariables['bar'], isNull); | 61 expect(options.definedVariables['bar'], isNull); |
61 }); | 62 }); |
62 | 63 |
| 64 test('disable cache flushing', () { |
| 65 CommandLineOptions options = CommandLineOptions |
| 66 .parse(['--dart-sdk', '.', '--disable-cache-flushing', 'foo.dart']); |
| 67 expect(options.disableCacheFlushing, isTrue); |
| 68 }); |
| 69 |
63 test('enable strict call checks', () { | 70 test('enable strict call checks', () { |
64 CommandLineOptions options = CommandLineOptions.parse( | 71 CommandLineOptions options = CommandLineOptions.parse( |
65 ['--dart-sdk', '.', '--enable-strict-call-checks', 'foo.dart']); | 72 ['--dart-sdk', '.', '--enable-strict-call-checks', 'foo.dart']); |
66 expect(options.enableStrictCallChecks, isTrue); | 73 expect(options.enableStrictCallChecks, isTrue); |
67 }); | 74 }); |
68 | 75 |
69 test('enable super mixins', () { | 76 test('enable super mixins', () { |
70 CommandLineOptions options = CommandLineOptions | 77 CommandLineOptions options = CommandLineOptions |
71 .parse(['--dart-sdk', '.', '--supermixin', 'foo.dart']); | 78 .parse(['--dart-sdk', '.', '--supermixin', 'foo.dart']); |
72 expect(options.enableSuperMixins, isTrue); | 79 expect(options.enableSuperMixins, isTrue); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 'package:p/foo.dart|/path/to/p/lib/foo.dart' | 352 'package:p/foo.dart|/path/to/p/lib/foo.dart' |
346 ]); | 353 ]); |
347 expect(options.buildMode, isTrue); | 354 expect(options.buildMode, isTrue); |
348 expect(options.buildSuppressExitCode, isTrue); | 355 expect(options.buildSuppressExitCode, isTrue); |
349 } | 356 } |
350 | 357 |
351 void _parse(List<String> args) { | 358 void _parse(List<String> args) { |
352 options = CommandLineOptions.parse(args); | 359 options = CommandLineOptions.parse(args); |
353 } | 360 } |
354 } | 361 } |
OLD | NEW |