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

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

Issue 88553003: pkg/args: a bunch of test cleanup (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 parse_test; 5 library parse_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 'shared.dart';
9 10
10 main() { 11 void main() {
11 group('ArgParser.parse()', () { 12 group('ArgParser.parse()', () {
12 test('does not destructively modify the argument list', () { 13 test('does not destructively modify the argument list', () {
13 var parser = new ArgParser(); 14 var parser = new ArgParser();
14 parser.addFlag('verbose'); 15 parser.addFlag('verbose');
15 16
16 var args = ['--verbose']; 17 var args = ['--verbose'];
17 var results = parser.parse(args); 18 var results = parser.parse(args);
18 expect(args, equals(['--verbose'])); 19 expect(args, equals(['--verbose']));
19 expect(results['verbose'], isTrue); 20 expect(results['verbose'], isTrue);
20 }); 21 });
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 var parser = new ArgParser(); 415 var parser = new ArgParser();
415 parser.addFlag('recurse', defaultsTo: false, abbr:'R'); 416 parser.addFlag('recurse', defaultsTo: false, abbr:'R');
416 var results = parser.parse(['-R']); 417 var results = parser.parse(['-R']);
417 expect(results['recurse'], isTrue); 418 expect(results['recurse'], isTrue);
418 expect(results.rest, [ ]); 419 expect(results.rest, [ ]);
419 throwsFormat(parser, ['-r']); 420 throwsFormat(parser, ['-r']);
420 }); 421 });
421 }); 422 });
422 }); 423 });
423 } 424 }
424
425 throwsIllegalArg(function) {
426 expect(function, throwsArgumentError);
427 }
428
429 throwsFormat(ArgParser parser, List<String> args) {
430 expect(() => parser.parse(args), throwsFormatException);
431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698