Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: pkg/analyzer/test/options_test.dart

Issue 725143004: Format and sort analyzer and analysis_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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:unittest/unittest.dart'; 8 import 'package:unittest/unittest.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 =
16 .parse(['--dart-sdk', '.', 'foo.dart']); 16 CommandLineOptions.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.enableTypeChecks, isFalse);
24 expect(options.ignoreUnrecognizedFlags, isFalse); 24 expect(options.ignoreUnrecognizedFlags, isFalse);
25 expect(options.log, isFalse); 25 expect(options.log, isFalse);
26 expect(options.machineFormat, isFalse); 26 expect(options.machineFormat, isFalse);
27 expect(options.packageRootPath, isNull); 27 expect(options.packageRootPath, isNull);
28 expect(options.perf, isFalse); 28 expect(options.perf, isFalse);
29 expect(options.shouldBatch, isFalse); 29 expect(options.shouldBatch, isFalse);
30 expect(options.showPackageWarnings, isFalse); 30 expect(options.showPackageWarnings, isFalse);
31 expect(options.showSdkWarnings, isFalse); 31 expect(options.showSdkWarnings, isFalse);
32 expect(options.sourceFiles, equals(['foo.dart'])); 32 expect(options.sourceFiles, equals(['foo.dart']));
33 expect(options.warmPerf, isFalse); 33 expect(options.warmPerf, isFalse);
34 expect(options.warningsAreFatal, isFalse); 34 expect(options.warningsAreFatal, isFalse);
35 }); 35 });
36 36
37 test('batch', () { 37 test('batch', () {
38 CommandLineOptions options = CommandLineOptions 38 CommandLineOptions options =
39 .parse(['--dart-sdk', '.', '--batch']); 39 CommandLineOptions.parse(['--dart-sdk', '.', '--batch']);
40 expect(options.shouldBatch, isTrue); 40 expect(options.shouldBatch, isTrue);
41 }); 41 });
42 42
43 test('defined variables', () { 43 test('defined variables', () {
44 CommandLineOptions options = CommandLineOptions 44 CommandLineOptions options =
45 .parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']); 45 CommandLineOptions.parse(['--dart-sdk', '.', '-Dfoo=bar', 'foo.dart']) ;
46 expect(options.definedVariables['foo'], equals('bar')); 46 expect(options.definedVariables['foo'], equals('bar'));
47 expect(options.definedVariables['bar'], isNull); 47 expect(options.definedVariables['bar'], isNull);
48 }); 48 });
49 49
50 test('enable async', () { 50 test('enable async', () {
51 CommandLineOptions options = CommandLineOptions 51 CommandLineOptions options =
52 .parse(['--dart-sdk', '.', '--enable-async', 'foo.dart']); 52 CommandLineOptions.parse(['--dart-sdk', '.', '--enable-async', 'foo.da rt']);
53 expect(options.enableAsync, isTrue); 53 expect(options.enableAsync, isTrue);
54 }); 54 });
55 55
56 test('enable enum', () { 56 test('enable enum', () {
57 CommandLineOptions options = CommandLineOptions 57 CommandLineOptions options =
58 .parse(['--dart-sdk', '.', '--enable-enum', 'foo.dart']); 58 CommandLineOptions.parse(['--dart-sdk', '.', '--enable-enum', 'foo.dar t']);
59 expect(options.enableEnum, isTrue); 59 expect(options.enableEnum, isTrue);
60 }); 60 });
61 61
62 test('enable type checks', () { 62 test('enable type checks', () {
63 CommandLineOptions options = CommandLineOptions 63 CommandLineOptions options = CommandLineOptions.parse(
64 .parse(['--dart-sdk', '.', '--enable_type_checks', 'foo.dart']); 64 ['--dart-sdk', '.', '--enable_type_checks', 'foo.dart']);
65 expect(options.enableTypeChecks, isTrue); 65 expect(options.enableTypeChecks, isTrue);
66 }); 66 });
67 67
68 test('log', () { 68 test('log', () {
69 CommandLineOptions options = CommandLineOptions 69 CommandLineOptions options =
70 .parse(['--dart-sdk', '.', '--log', 'foo.dart']); 70 CommandLineOptions.parse(['--dart-sdk', '.', '--log', 'foo.dart']);
71 expect(options.log, isTrue); 71 expect(options.log, isTrue);
72 }); 72 });
73 73
74 test('machine format', () { 74 test('machine format', () {
75 CommandLineOptions options = CommandLineOptions 75 CommandLineOptions options =
76 .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']); 76 CommandLineOptions.parse(['--dart-sdk', '.', '--format=machine', 'foo. dart']);
77 expect(options.machineFormat, isTrue); 77 expect(options.machineFormat, isTrue);
78 }); 78 });
79 79
80 test('no-hints', () { 80 test('no-hints', () {
81 CommandLineOptions options = CommandLineOptions 81 CommandLineOptions options =
82 .parse(['--dart-sdk', '.', '--no-hints', 'foo.dart']); 82 CommandLineOptions.parse(['--dart-sdk', '.', '--no-hints', 'foo.dart'] );
83 expect(options.disableHints, isTrue); 83 expect(options.disableHints, isTrue);
84 }); 84 });
85 85
86 test('package root', () { 86 test('package root', () {
87 CommandLineOptions options = CommandLineOptions 87 CommandLineOptions options =
88 .parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']); 88 CommandLineOptions.parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']) ;
89 expect(options.packageRootPath, equals('bar')); 89 expect(options.packageRootPath, equals('bar'));
90 }); 90 });
91 91
92 test('package warnings', () { 92 test('package warnings', () {
93 CommandLineOptions options = CommandLineOptions 93 CommandLineOptions options = CommandLineOptions.parse(
94 .parse(['--dart-sdk', '.', '--package-warnings', 'foo.dart']); 94 ['--dart-sdk', '.', '--package-warnings', 'foo.dart']);
95 expect(options.showPackageWarnings, isTrue); 95 expect(options.showPackageWarnings, isTrue);
96 }); 96 });
97 97
98 test('perf', () { 98 test('perf', () {
99 CommandLineOptions options = CommandLineOptions 99 CommandLineOptions options =
100 .parse(['--dart-sdk', '.', '--perf', 'foo.dart']); 100 CommandLineOptions.parse(['--dart-sdk', '.', '--perf', 'foo.dart']);
101 expect(options.perf, isTrue); 101 expect(options.perf, isTrue);
102 }); 102 });
103 103
104 test('sdk warnings', () { 104 test('sdk warnings', () {
105 CommandLineOptions options = CommandLineOptions 105 CommandLineOptions options =
106 .parse(['--dart-sdk', '.', '--warnings', 'foo.dart']); 106 CommandLineOptions.parse(['--dart-sdk', '.', '--warnings', 'foo.dart'] );
107 expect(options.showSdkWarnings, isTrue); 107 expect(options.showSdkWarnings, isTrue);
108 }); 108 });
109 109
110 test('sourceFiles', () { 110 test('sourceFiles', () {
111 CommandLineOptions options = CommandLineOptions 111 CommandLineOptions options = CommandLineOptions.parse(
112 .parse(['--dart-sdk', '.', '--log', 'foo.dart', 'foo2.dart', 'foo3.dar t']); 112 ['--dart-sdk', '.', '--log', 'foo.dart', 'foo2.dart', 'foo3.dart']);
113 expect(options.sourceFiles, equals(['foo.dart', 'foo2.dart', 'foo3.dart']) ); 113 expect(
114 options.sourceFiles,
115 equals(['foo.dart', 'foo2.dart', 'foo3.dart']));
114 }); 116 });
115 117
116 test('warningsAreFatal', () { 118 test('warningsAreFatal', () {
117 CommandLineOptions options = CommandLineOptions 119 CommandLineOptions options =
118 .parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.dart']); 120 CommandLineOptions.parse(['--dart-sdk', '.', '--fatal-warnings', 'foo. dart']);
119 expect(options.warningsAreFatal, isTrue); 121 expect(options.warningsAreFatal, isTrue);
120 }); 122 });
121 123
122 // test('notice unrecognized flags', () { 124 // test('notice unrecognized flags', () {
123 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b az', 125 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b az',
124 // 'foo.dart']); 126 // 'foo.dart']);
125 // expect(options, isNull); 127 // expect(options, isNull);
126 // }); 128 // });
127 // 129 //
128 // test('ignore unrecognized flags', () { 130 // test('ignore unrecognized flags', () {
129 // CommandLineOptions options = new CommandLineOptions.parse([ 131 // CommandLineOptions options = new CommandLineOptions.parse([
130 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); 132 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']);
131 // expect(options, isNotNull); 133 // expect(options, isNotNull);
132 // expect(options.sourceFiles, equals(['foo.dart'])); 134 // expect(options.sourceFiles, equals(['foo.dart']));
133 // }); 135 // });
134 136
135 }); 137 });
136 138
137 } 139 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/utilities_test.dart ('k') | pkg/analyzer/test/parse_compilation_unit_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698