| 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 | 9 |
| 10 main() { | 10 main() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 expect(options.log, isFalse); | 23 expect(options.log, isFalse); |
| 24 expect(options.machineFormat, isFalse); | 24 expect(options.machineFormat, isFalse); |
| 25 expect(options.packageRootPath, isNull); | 25 expect(options.packageRootPath, isNull); |
| 26 expect(options.perf, isFalse); | 26 expect(options.perf, isFalse); |
| 27 expect(options.shouldBatch, isFalse); | 27 expect(options.shouldBatch, isFalse); |
| 28 expect(options.showPackageWarnings, isFalse); | 28 expect(options.showPackageWarnings, isFalse); |
| 29 expect(options.showSdkWarnings, isFalse); | 29 expect(options.showSdkWarnings, isFalse); |
| 30 expect(options.sourceFiles, equals(['foo.dart'])); | 30 expect(options.sourceFiles, equals(['foo.dart'])); |
| 31 expect(options.warmPerf, isFalse); | 31 expect(options.warmPerf, isFalse); |
| 32 expect(options.warningsAreFatal, isFalse); | 32 expect(options.warningsAreFatal, isFalse); |
| 33 expect(options.customUrlMappings, isNotNull); |
| 34 expect(options.customUrlMappings.isEmpty, isTrue); |
| 33 }); | 35 }); |
| 34 | 36 |
| 35 test('batch', () { | 37 test('batch', () { |
| 36 CommandLineOptions options = | 38 CommandLineOptions options = |
| 37 CommandLineOptions.parse(['--dart-sdk', '.', '--batch']); | 39 CommandLineOptions.parse(['--dart-sdk', '.', '--batch']); |
| 38 expect(options.shouldBatch, isTrue); | 40 expect(options.shouldBatch, isTrue); |
| 39 }); | 41 }); |
| 40 | 42 |
| 41 test('defined variables', () { | 43 test('defined variables', () { |
| 42 CommandLineOptions options = | 44 CommandLineOptions options = |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 options.sourceFiles, | 102 options.sourceFiles, |
| 101 equals(['foo.dart', 'foo2.dart', 'foo3.dart'])); | 103 equals(['foo.dart', 'foo2.dart', 'foo3.dart'])); |
| 102 }); | 104 }); |
| 103 | 105 |
| 104 test('warningsAreFatal', () { | 106 test('warningsAreFatal', () { |
| 105 CommandLineOptions options = | 107 CommandLineOptions options = |
| 106 CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.
dart']); | 108 CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.
dart']); |
| 107 expect(options.warningsAreFatal, isTrue); | 109 expect(options.warningsAreFatal, isTrue); |
| 108 }); | 110 }); |
| 109 | 111 |
| 112 test('customUrlMappings', () { |
| 113 CommandLineOptions options = CommandLineOptions.parse([ |
| 114 '--dart-sdk', '.', |
| 115 '--url_mapping', 'dart:dummy,/path/to/dummy.dart', |
| 116 'foo.dart']); |
| 117 expect(options.customUrlMappings, isNotNull); |
| 118 expect(options.customUrlMappings.isEmpty, isFalse); |
| 119 expect(options.customUrlMappings['dart:dummy'], |
| 120 equals('/path/to/dummy.dart')); |
| 121 }); |
| 122 |
| 110 // test('notice unrecognized flags', () { | 123 // test('notice unrecognized flags', () { |
| 111 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b
az', | 124 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b
az', |
| 112 // 'foo.dart']); | 125 // 'foo.dart']); |
| 113 // expect(options, isNull); | 126 // expect(options, isNull); |
| 114 // }); | 127 // }); |
| 115 // | 128 // |
| 116 // test('ignore unrecognized flags', () { | 129 // test('ignore unrecognized flags', () { |
| 117 // CommandLineOptions options = new CommandLineOptions.parse([ | 130 // CommandLineOptions options = new CommandLineOptions.parse([ |
| 118 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); | 131 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); |
| 119 // expect(options, isNotNull); | 132 // expect(options, isNotNull); |
| 120 // expect(options.sourceFiles, equals(['foo.dart'])); | 133 // expect(options.sourceFiles, equals(['foo.dart'])); |
| 121 // }); | 134 // }); |
| 122 | 135 |
| 123 }); | 136 }); |
| 124 | 137 |
| 125 } | 138 } |
| OLD | NEW |