| Index: pkg/analyzer/test/options_test.dart
|
| diff --git a/pkg/analyzer/test/options_test.dart b/pkg/analyzer/test/options_test.dart
|
| index 4830306182a51e0a9d73fa7869c4a1ff927bf66e..fcff6ef73579438d4fda3129898e5b5c747aa60e 100644
|
| --- a/pkg/analyzer/test/options_test.dart
|
| +++ b/pkg/analyzer/test/options_test.dart
|
| @@ -11,9 +11,7 @@ import 'package:unittest/unittest.dart';
|
| import 'reflective_tests.dart';
|
|
|
| main() {
|
| -
|
| group('AnalyzerOptions.parse()', () {
|
| -
|
| test('defaults', () {
|
| CommandLineOptions options =
|
| CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']);
|
| @@ -44,15 +42,15 @@ main() {
|
| });
|
|
|
| test('defined variables', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']);
|
| expect(options.definedVariables['foo'], equals('bar'));
|
| expect(options.definedVariables['bar'], isNull);
|
| });
|
|
|
| test('enable type checks', () {
|
| - CommandLineOptions options = CommandLineOptions.parse(
|
| - ['--dart-sdk', '.', '--enable_type_checks', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--enable_type_checks', 'foo.dart']);
|
| expect(options.enableTypeChecks, isTrue);
|
| });
|
|
|
| @@ -63,26 +61,26 @@ main() {
|
| });
|
|
|
| test('machine format', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']);
|
| expect(options.machineFormat, isTrue);
|
| });
|
|
|
| test('no-hints', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '--no-hints', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--no-hints', 'foo.dart']);
|
| expect(options.disableHints, isTrue);
|
| });
|
|
|
| test('package root', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']);
|
| expect(options.packageRootPath, equals('bar'));
|
| });
|
|
|
| test('package warnings', () {
|
| - CommandLineOptions options = CommandLineOptions.parse(
|
| - ['--dart-sdk', '.', '--package-warnings', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--package-warnings', 'foo.dart']);
|
| expect(options.showPackageWarnings, isTrue);
|
| });
|
|
|
| @@ -93,8 +91,8 @@ main() {
|
| });
|
|
|
| test('sdk warnings', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '--warnings', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--warnings', 'foo.dart']);
|
| expect(options.showSdkWarnings, isTrue);
|
| });
|
|
|
| @@ -102,28 +100,26 @@ main() {
|
| CommandLineOptions options = CommandLineOptions.parse(
|
| ['--dart-sdk', '.', '--log', 'foo.dart', 'foo2.dart', 'foo3.dart']);
|
| expect(
|
| - options.sourceFiles,
|
| - equals(['foo.dart', 'foo2.dart', 'foo3.dart']));
|
| + options.sourceFiles, equals(['foo.dart', 'foo2.dart', 'foo3.dart']));
|
| });
|
|
|
| test('warningsAreFatal', () {
|
| - CommandLineOptions options =
|
| - CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions
|
| + .parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.dart']);
|
| expect(options.warningsAreFatal, isTrue);
|
| });
|
|
|
| test('customUrlMappings', () {
|
| - CommandLineOptions options = CommandLineOptions.parse(
|
| - [
|
| - '--dart-sdk',
|
| - '.',
|
| - '--url-mapping',
|
| - 'dart:dummy,/path/to/dummy.dart',
|
| - 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions.parse([
|
| + '--dart-sdk',
|
| + '.',
|
| + '--url-mapping',
|
| + 'dart:dummy,/path/to/dummy.dart',
|
| + 'foo.dart'
|
| + ]);
|
| expect(options.customUrlMappings, isNotNull);
|
| expect(options.customUrlMappings.isEmpty, isFalse);
|
| - expect(
|
| - options.customUrlMappings['dart:dummy'],
|
| + expect(options.customUrlMappings['dart:dummy'],
|
| equals('/path/to/dummy.dart'));
|
| });
|
|
|
| @@ -134,24 +130,22 @@ main() {
|
| // });
|
|
|
| test('ignore unrecognized flags', () {
|
| - CommandLineOptions options = CommandLineOptions.parse(
|
| - [
|
| - '--ignore-unrecognized-flags',
|
| - '--bar',
|
| - '--baz',
|
| - '--dart-sdk',
|
| - '.',
|
| - 'foo.dart']);
|
| + CommandLineOptions options = CommandLineOptions.parse([
|
| + '--ignore-unrecognized-flags',
|
| + '--bar',
|
| + '--baz',
|
| + '--dart-sdk',
|
| + '.',
|
| + 'foo.dart'
|
| + ]);
|
| expect(options, isNotNull);
|
| expect(options.sourceFiles, equals(['foo.dart']));
|
| });
|
| -
|
| });
|
|
|
| runReflectiveTests(CommandLineParserTest);
|
| }
|
|
|
| -
|
| @reflectiveTest
|
| class CommandLineParserTest {
|
| test_ignoreUnrecognizedOptions() {
|
|
|