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

Side by Side Diff: pkg/args/test/parse_all_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: nits 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
« no previous file with comments | « pkg/args/test/command_test.dart ('k') | pkg/args/test/parse_test.dart » ('j') | 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 parse_all_test; 5 library parse_all_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 9
10 main() { 10 void main() {
11 group('ArgParser.parse(allowTrailingOptions: true) ' 11 group('ArgParser.parse(allowTrailingOptions: true) '
12 'starting with a non-option', () { 12 'starting with a non-option', () {
13 test('followed by flag', () { 13 test('followed by flag', () {
14 var parser = new ArgParser()..addFlag('flag'); 14 var parser = new ArgParser()..addFlag('flag');
15 var args = ['A', '--flag']; 15 var args = ['A', '--flag'];
16 16
17 var resultsAll = parser.parse(args, allowTrailingOptions: true); 17 var resultsAll = parser.parse(args, allowTrailingOptions: true);
18 expect(resultsAll['flag'], isTrue); 18 expect(resultsAll['flag'], isTrue);
19 expect(resultsAll.rest, equals(['A'])); 19 expect(resultsAll.rest, equals(['A']));
20 }); 20 });
(...skipping 29 matching lines...) Expand all
50 }); 50 });
51 51
52 test('followed by command', () { 52 test('followed by command', () {
53 var parser = new ArgParser()..addCommand('com'); 53 var parser = new ArgParser()..addCommand('com');
54 var args = ['A', 'com']; 54 var args = ['A', 'com'];
55 55
56 expectThrows(parser, args); 56 expectThrows(parser, args);
57 }); 57 });
58 }); 58 });
59 } 59 }
60 expectThrows(ArgParser parser, List<String> args) => 60
61 void expectThrows(ArgParser parser, List<String> args) =>
61 expect(() => parser.parse(args, allowTrailingOptions: true), 62 expect(() => parser.parse(args, allowTrailingOptions: true),
62 throwsFormatException, 63 throwsFormatException,
63 reason: "with allowTrailingOptions: true"); 64 reason: "with allowTrailingOptions: true");
OLDNEW
« no previous file with comments | « pkg/args/test/command_test.dart ('k') | pkg/args/test/parse_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698