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

Side by Side Diff: pkg/args/test/args_test.dart

Issue 796593004: Add an ArgResults.original getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years 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/args/pubspec.yaml ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 args_test; 5 library args_test;
6 6
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'package:args/args.dart'; 8 import 'package:args/args.dart';
9 import 'utils.dart'; 9 import 'utils.dart';
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 test('[] throws if the name is not an option', () { 221 test('[] throws if the name is not an option', () {
222 var results = new ArgParser().parse([]); 222 var results = new ArgParser().parse([]);
223 throwsIllegalArg(() => results['unknown']); 223 throwsIllegalArg(() => results['unknown']);
224 }); 224 });
225 225
226 test('rest cannot be modified', () { 226 test('rest cannot be modified', () {
227 var results = new ArgParser().parse([]); 227 var results = new ArgParser().parse([]);
228 expect(() => results.rest.add('oops'), throwsUnsupportedError); 228 expect(() => results.rest.add('oops'), throwsUnsupportedError);
229 }); 229 });
230 230
231 test('.arguments returns the original argument list', () {
232 var parser = new ArgParser();
233 parser.addFlag('foo');
234
235 var results = parser.parse(['--foo']);
236 expect(results.arguments, equals(['--foo']));
237 });
238
231 group('.wasParsed()', () { 239 group('.wasParsed()', () {
232 test('throws if the name is not an option', () { 240 test('throws if the name is not an option', () {
233 var results = new ArgParser().parse([]); 241 var results = new ArgParser().parse([]);
234 throwsIllegalArg(() => results.wasParsed('unknown')); 242 throwsIllegalArg(() => results.wasParsed('unknown'));
235 }); 243 });
236 244
237 test('returns true for parsed options', () { 245 test('returns true for parsed options', () {
238 var parser = new ArgParser(); 246 var parser = new ArgParser();
239 parser.addFlag('fast'); 247 parser.addFlag('fast');
240 parser.addFlag('verbose'); 248 parser.addFlag('verbose');
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 const _VALID_OPTIONS = const [ 300 const _VALID_OPTIONS = const [
293 'a' // One character. 301 'a' // One character.
294 'contains-dash', 302 'contains-dash',
295 'contains_underscore', 303 'contains_underscore',
296 'ends-with-dash-', 304 'ends-with-dash-',
297 'contains--doubledash--', 305 'contains--doubledash--',
298 '1starts-with-number', 306 '1starts-with-number',
299 'contains-a-1number', 307 'contains-a-1number',
300 'ends-with-a-number8' 308 'ends-with-a-number8'
301 ]; 309 ];
OLDNEW
« no previous file with comments | « pkg/args/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698