| 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:analyzer/options.dart'; | 7 import 'package:analyzer/options.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 import 'package:args/args.dart'; |
| 9 | 10 |
| 10 main() { | 11 main() { |
| 11 | 12 |
| 12 group('AnalyzerOptions.parse()', () { | 13 group('AnalyzerOptions.parse()', () { |
| 13 | 14 |
| 14 test('defaults', () { | 15 test('defaults', () { |
| 15 CommandLineOptions options = | 16 CommandLineOptions options = |
| 16 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); | 17 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); |
| 17 expect(options, isNotNull); | 18 expect(options, isNotNull); |
| 18 expect(options.dartSdkPath, isNotNull); | 19 expect(options.dartSdkPath, isNotNull); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 equals(['foo.dart', 'foo2.dart', 'foo3.dart'])); | 104 equals(['foo.dart', 'foo2.dart', 'foo3.dart'])); |
| 104 }); | 105 }); |
| 105 | 106 |
| 106 test('warningsAreFatal', () { | 107 test('warningsAreFatal', () { |
| 107 CommandLineOptions options = | 108 CommandLineOptions options = |
| 108 CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.
dart']); | 109 CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.
dart']); |
| 109 expect(options.warningsAreFatal, isTrue); | 110 expect(options.warningsAreFatal, isTrue); |
| 110 }); | 111 }); |
| 111 | 112 |
| 112 test('customUrlMappings', () { | 113 test('customUrlMappings', () { |
| 113 CommandLineOptions options = CommandLineOptions.parse([ | 114 CommandLineOptions options = CommandLineOptions.parse( |
| 114 '--dart-sdk', '.', | 115 [ |
| 115 '--url-mapping', 'dart:dummy,/path/to/dummy.dart', | 116 '--dart-sdk', |
| 116 'foo.dart']); | 117 '.', |
| 118 '--url-mapping', |
| 119 'dart:dummy,/path/to/dummy.dart', |
| 120 'foo.dart']); |
| 117 expect(options.customUrlMappings, isNotNull); | 121 expect(options.customUrlMappings, isNotNull); |
| 118 expect(options.customUrlMappings.isEmpty, isFalse); | 122 expect(options.customUrlMappings.isEmpty, isFalse); |
| 119 expect(options.customUrlMappings['dart:dummy'], | 123 expect( |
| 120 equals('/path/to/dummy.dart')); | 124 options.customUrlMappings['dart:dummy'], |
| 125 equals('/path/to/dummy.dart')); |
| 121 }); | 126 }); |
| 122 | 127 |
| 123 // test('notice unrecognized flags', () { | 128 // test('notice unrecognized flags', () { |
| 124 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b
az', | 129 // CommandLineOptions options = CommandLineOptions.parse(['--bar', '--baz', |
| 125 // 'foo.dart']); | 130 // 'foo.dart']); |
| 126 // expect(options, isNull); | 131 // expect(options, isNull); |
| 127 // }); | 132 // }); |
| 128 // | 133 |
| 129 // test('ignore unrecognized flags', () { | 134 test('ignore unrecognized flags', () { |
| 130 // CommandLineOptions options = new CommandLineOptions.parse([ | 135 CommandLineOptions options = CommandLineOptions.parse( |
| 131 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); | 136 [ |
| 132 // expect(options, isNotNull); | 137 '--ignore-unrecognized-flags', |
| 133 // expect(options.sourceFiles, equals(['foo.dart'])); | 138 '--bar', |
| 134 // }); | 139 '--baz', |
| 140 '--dart-sdk', |
| 141 '.', |
| 142 'foo.dart']); |
| 143 expect(options, isNotNull); |
| 144 expect(options.sourceFiles, equals(['foo.dart'])); |
| 145 }); |
| 135 | 146 |
| 136 }); | 147 }); |
| 137 | 148 |
| 138 } | 149 } |
| OLD | NEW |