| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 options_test; | 5 library options_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:analyzer/options.dart'; | 8 import 'package:analyzer/options.dart'; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 | 11 |
| 12 group('AnalyzerOptions.parse()', () { | 12 group('AnalyzerOptions.parse()', () { |
| 13 | 13 |
| 14 test('defaults', () { | 14 test('defaults', () { |
| 15 CommandLineOptions options = CommandLineOptions | 15 CommandLineOptions options = CommandLineOptions |
| 16 .parse(['--dart-sdk', '.', 'foo.dart']); | 16 .parse(['--dart-sdk', '.', 'foo.dart']); |
| 17 expect(options, isNotNull); | 17 expect(options, isNotNull); |
| 18 expect(options.dartSdkPath, isNotNull); | 18 expect(options.dartSdkPath, isNotNull); |
| 19 expect(options.disableHints, isFalse); | 19 expect(options.disableHints, isFalse); |
| 20 expect(options.displayVersion, isFalse); | 20 expect(options.displayVersion, isFalse); |
| 21 expect(options.enableAsync, isFalse); | 21 expect(options.enableAsync, isFalse); |
| 22 expect(options.enableEnum, isFalse); | 22 expect(options.enableEnum, isFalse); |
| 23 expect(options.enableTypeChecks, isFalse); |
| 23 expect(options.ignoreUnrecognizedFlags, isFalse); | 24 expect(options.ignoreUnrecognizedFlags, isFalse); |
| 24 expect(options.log, isFalse); | 25 expect(options.log, isFalse); |
| 25 expect(options.machineFormat, isFalse); | 26 expect(options.machineFormat, isFalse); |
| 26 expect(options.packageRootPath, isNull); | 27 expect(options.packageRootPath, isNull); |
| 27 expect(options.perf, isFalse); | 28 expect(options.perf, isFalse); |
| 28 expect(options.shouldBatch, isFalse); | 29 expect(options.shouldBatch, isFalse); |
| 29 expect(options.showPackageWarnings, isFalse); | 30 expect(options.showPackageWarnings, isFalse); |
| 30 expect(options.showSdkWarnings, isFalse); | 31 expect(options.showSdkWarnings, isFalse); |
| 31 expect(options.sourceFiles, equals(['foo.dart'])); | 32 expect(options.sourceFiles, equals(['foo.dart'])); |
| 32 expect(options.warmPerf, isFalse); | 33 expect(options.warmPerf, isFalse); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 .parse(['--dart-sdk', '.', '--enable-async', 'foo.dart']); | 52 .parse(['--dart-sdk', '.', '--enable-async', 'foo.dart']); |
| 52 expect(options.enableAsync, isTrue); | 53 expect(options.enableAsync, isTrue); |
| 53 }); | 54 }); |
| 54 | 55 |
| 55 test('enable enum', () { | 56 test('enable enum', () { |
| 56 CommandLineOptions options = CommandLineOptions | 57 CommandLineOptions options = CommandLineOptions |
| 57 .parse(['--dart-sdk', '.', '--enable-enum', 'foo.dart']); | 58 .parse(['--dart-sdk', '.', '--enable-enum', 'foo.dart']); |
| 58 expect(options.enableEnum, isTrue); | 59 expect(options.enableEnum, isTrue); |
| 59 }); | 60 }); |
| 60 | 61 |
| 62 test('enable type checks', () { |
| 63 CommandLineOptions options = CommandLineOptions |
| 64 .parse(['--dart-sdk', '.', '--enable_type_cheks', 'foo.dart']); |
| 65 expect(options.enableTypeChecks, isTrue); |
| 66 }); |
| 67 |
| 61 test('log', () { | 68 test('log', () { |
| 62 CommandLineOptions options = CommandLineOptions | 69 CommandLineOptions options = CommandLineOptions |
| 63 .parse(['--dart-sdk', '.', '--log', 'foo.dart']); | 70 .parse(['--dart-sdk', '.', '--log', 'foo.dart']); |
| 64 expect(options.log, isTrue); | 71 expect(options.log, isTrue); |
| 65 }); | 72 }); |
| 66 | 73 |
| 67 test('machine format', () { | 74 test('machine format', () { |
| 68 CommandLineOptions options = CommandLineOptions | 75 CommandLineOptions options = CommandLineOptions |
| 69 .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']); | 76 .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']); |
| 70 expect(options.machineFormat, isTrue); | 77 expect(options.machineFormat, isTrue); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // test('ignore unrecognized flags', () { | 128 // test('ignore unrecognized flags', () { |
| 122 // CommandLineOptions options = new CommandLineOptions.parse([ | 129 // CommandLineOptions options = new CommandLineOptions.parse([ |
| 123 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); | 130 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); |
| 124 // expect(options, isNotNull); | 131 // expect(options, isNotNull); |
| 125 // expect(options.sourceFiles, equals(['foo.dart'])); | 132 // expect(options.sourceFiles, equals(['foo.dart'])); |
| 126 // }); | 133 // }); |
| 127 | 134 |
| 128 }); | 135 }); |
| 129 | 136 |
| 130 } | 137 } |
| OLD | NEW |