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

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

Issue 17333004: Added new style of tests for parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed outer group and made local variables. Created 7 years, 6 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 | « no previous file | 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library parse_all_test;
6
7 import 'package:unittest/unittest.dart';
8 import 'package:args/args.dart';
9
10 main() {
11 group('ArgParser.parse() starting with a non-option', () {
12 test('followed by flag', () {
13 var parser = new ArgParser()..addFlag('flag');
14 var args = ['A', '--flag'];
15
16 var results = parser.parse(args);
17 expect(results['flag'], isFalse);
18 expect(results.rest, orderedEquals(args));
19 });
20
21 test('followed by option', () {
22 var parser = new ArgParser()..addOption('opt');
23 var args = ['A', '--opt'];
24
25 var results = parser.parse(args);
26 expect(results['opt'], isNull);
27 expect(results.rest, orderedEquals(args));
28 });
29
30 test('followed by option and value', () {
31 var parser = new ArgParser()..addOption('opt');
32 var args = ['A', '--opt', 'V'];
33
34 var results = parser.parse(args);
35 expect(results['opt'], isNull);
36 expect(results.rest, orderedEquals(args));
37 });
38
39 test('followed by unknown flag', () {
40 var parser = new ArgParser();
41 var args = ['A', '--xflag'];
42 var results = parser.parse(args);
43 expect(results.rest, orderedEquals(args));
44 });
45
46 test('followed by unknown option and value', () {
47 var parser = new ArgParser();
48 var args = ['A', '--xopt', 'V'];
49 var results = parser.parse(args);
50 expect(results.rest, orderedEquals(args));
51 });
52
53 test('followed by command', () {
54 var parser = new ArgParser()..addCommand('com');
55 var args = ['A', 'com'];
56
57 var results = parser.parse(args);
58 expect(results.command, isNull);
59 expect(results.rest, orderedEquals(args));
60 });
61 });
62 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698