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

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

Issue 199543002: Addtional tests in options.dart to cover 'log' case, and other missed flag tests as they were added. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months 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
« no previous file with comments | « pkg/analyzer/test/error_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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: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.shouldBatch, isFalse); 18 expect(options.shouldBatch, isFalse);
19 expect(options.machineFormat, isFalse); 19 expect(options.machineFormat, isFalse);
20 expect(options.displayVersion, isFalse);
21 expect(options.disableHints, isFalse);
20 expect(options.ignoreUnrecognizedFlags, isFalse); 22 expect(options.ignoreUnrecognizedFlags, isFalse);
23 expect(options.perf, isFalse);
21 expect(options.showPackageWarnings, isFalse); 24 expect(options.showPackageWarnings, isFalse);
22 expect(options.showSdkWarnings, isFalse); 25 expect(options.showSdkWarnings, isFalse);
23 expect(options.warningsAreFatal, isFalse); 26 expect(options.warningsAreFatal, isFalse);
24 expect(options.dartSdkPath, isNotNull); 27 expect(options.dartSdkPath, isNotNull);
28 expect(options.log, isFalse);
25 expect(options.sourceFiles, equals(['foo.dart'])); 29 expect(options.sourceFiles, equals(['foo.dart']));
26 }); 30 });
27 31
32 test('batch', () {
33 CommandLineOptions options = CommandLineOptions
34 .parse(['--dart-sdk', '.', '--batch']);
35 expect(options.shouldBatch, isTrue);
36 });
37
28 test('machine format', () { 38 test('machine format', () {
29 CommandLineOptions options = CommandLineOptions 39 CommandLineOptions options = CommandLineOptions
30 .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']); 40 .parse(['--dart-sdk', '.', '--format=machine', 'foo.dart']);
31 expect(options.machineFormat, isTrue); 41 expect(options.machineFormat, isTrue);
32 }); 42 });
33 43
34 test('package root', () { 44 test('no-hints', () {
35 CommandLineOptions options = CommandLineOptions 45 CommandLineOptions options = CommandLineOptions
36 .parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']); 46 .parse(['--dart-sdk', '.', '--no-hints', 'foo.dart']);
37 expect(options.packageRootPath, equals('bar')); 47 expect(options.disableHints, isTrue);
48 });
49
50 test('perf', () {
51 CommandLineOptions options = CommandLineOptions
52 .parse(['--dart-sdk', '.', '--perf', 'foo.dart']);
53 expect(options.perf, isTrue);
38 }); 54 });
39 55
40 test('package warnings', () { 56 test('package warnings', () {
41 CommandLineOptions options = CommandLineOptions 57 CommandLineOptions options = CommandLineOptions
42 .parse(['--dart-sdk', '.', '--package-warnings', 'foo.dart']); 58 .parse(['--dart-sdk', '.', '--package-warnings', 'foo.dart']);
43 expect(options.showPackageWarnings, isTrue); 59 expect(options.showPackageWarnings, isTrue);
44 }); 60 });
45 61
46 test('sdk warnings', () { 62 test('sdk warnings', () {
47 CommandLineOptions options = CommandLineOptions 63 CommandLineOptions options = CommandLineOptions
48 .parse(['--dart-sdk', '.', '--warnings', 'foo.dart']); 64 .parse(['--dart-sdk', '.', '--warnings', 'foo.dart']);
49 expect(options.showSdkWarnings, isTrue); 65 expect(options.showSdkWarnings, isTrue);
50 }); 66 });
51 67
68 test('warningsAreFatal', () {
69 CommandLineOptions options = CommandLineOptions
70 .parse(['--dart-sdk', '.', '--fatal-warnings', 'foo.dart']);
71 expect(options.warningsAreFatal, isTrue);
72 });
73
74 test('package root', () {
75 CommandLineOptions options = CommandLineOptions
76 .parse(['--dart-sdk', '.', '-p', 'bar', 'foo.dart']);
77 expect(options.packageRootPath, equals('bar'));
78 });
79
80 test('log', () {
81 CommandLineOptions options = CommandLineOptions
82 .parse(['--dart-sdk', '.', '--log', 'foo.dart']);
83 expect(options.log, isTrue);
84 });
85
86 test('sourceFiles', () {
87 CommandLineOptions options = CommandLineOptions
88 .parse(['--dart-sdk', '.', '--log', 'foo.dart', 'foo2.dart', 'foo3.dar t']);
89 expect(options.sourceFiles, equals(['foo.dart', 'foo2.dart', 'foo3.dart']) );
90 });
91
52 // test('notice unrecognized flags', () { 92 // test('notice unrecognized flags', () {
53 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b az', 93 // CommandLineOptions options = new CommandLineOptions.parse(['--bar', '--b az',
54 // 'foo.dart']); 94 // 'foo.dart']);
55 // expect(options, isNull); 95 // expect(options, isNull);
56 // }); 96 // });
57 // 97 //
58 // test('ignore unrecognized flags', () { 98 // test('ignore unrecognized flags', () {
59 // CommandLineOptions options = new CommandLineOptions.parse([ 99 // CommandLineOptions options = new CommandLineOptions.parse([
60 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']); 100 // '--ignore_unrecognized_flags', '--bar', '--baz', 'foo.dart']);
61 // expect(options, isNotNull); 101 // expect(options, isNotNull);
62 // expect(options.sourceFiles, equals(['foo.dart'])); 102 // expect(options.sourceFiles, equals(['foo.dart']));
63 // }); 103 // });
64 104
65 }); 105 });
66 106
67 } 107 }
68
OLDNEW
« no previous file with comments | « pkg/analyzer/test/error_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698