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

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

Issue 944073003: Fix for filtering unknown options. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/lib/options.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:analyzer/options.dart'; 7 import 'package:analyzer/options.dart';
8 import 'package:args/args.dart';
8 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
9 import 'package:args/args.dart'; 10
11 import 'reflective_tests.dart';
10 12
11 main() { 13 main() {
12 14
13 group('AnalyzerOptions.parse()', () { 15 group('AnalyzerOptions.parse()', () {
14 16
15 test('defaults', () { 17 test('defaults', () {
16 CommandLineOptions options = 18 CommandLineOptions options =
17 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']); 19 CommandLineOptions.parse(['--dart-sdk', '.', 'foo.dart']);
18 expect(options, isNotNull); 20 expect(options, isNotNull);
19 expect(options.dartSdkPath, isNotNull); 21 expect(options.dartSdkPath, isNotNull);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 '--baz', 141 '--baz',
140 '--dart-sdk', 142 '--dart-sdk',
141 '.', 143 '.',
142 'foo.dart']); 144 'foo.dart']);
143 expect(options, isNotNull); 145 expect(options, isNotNull);
144 expect(options.sourceFiles, equals(['foo.dart'])); 146 expect(options.sourceFiles, equals(['foo.dart']));
145 }); 147 });
146 148
147 }); 149 });
148 150
151 runReflectiveTests(CommandLineParserTest);
149 } 152 }
153
154
155 @reflectiveTest
156 class CommandLineParserTest {
157 test_ignoreUnrecognizedOptions() {
158 CommandLineParser parser =
159 new CommandLineParser(alwaysIgnoreUnrecognized: true);
160 parser.addOption('optionA');
161 parser.addFlag('flagA');
162 ArgResults argResults =
163 parser.parse(['--optionA=1', '--optionB=2', '--flagA'], {});
164 expect(argResults['optionA'], '1');
165 expect(argResults['flagA'], isTrue);
166 }
167 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698