Chromium Code Reviews| Index: pkg/args/test/parse_test.dart |
| diff --git a/pkg/args/test/parse_test.dart b/pkg/args/test/parse_test.dart |
| index 715c2269218537157fff9a758ef37005905de3cc..fc5dc9c1fe94500d3a3d0f5c1c6bc86077a23247 100644 |
| --- a/pkg/args/test/parse_test.dart |
| +++ b/pkg/args/test/parse_test.dart |
| @@ -389,14 +389,36 @@ main() { |
| test('stops parsing args when a non-option-like arg is encountered', () { |
| var parser = new ArgParser(); |
| parser.addFlag('woof'); |
| + parser.addFlag('neigh'); |
| parser.addOption('meow'); |
| parser.addOption('tweet', defaultsTo: 'bird'); |
| - var results = parser.parse(['--woof', '--meow', 'v', 'not', 'option']); |
| + var results = parser.parse(['--woof', '--meow', 'v', 'not', 'option', |
| + '--tweet', 'devrel', '--neigh', 'end' ]); |
|
Bob Nystrom
2013/04/19 22:13:18
Indent +2.
|
| expect(results['woof'], isTrue); |
| + expect(results['neigh'], isFalse); |
| expect(results['meow'], equals('v')); |
| expect(results['tweet'], equals('bird')); |
| - expect(results.rest, orderedEquals(['not', 'option'])); |
| + expect(results.rest, orderedEquals(['not', 'option', '--tweet', |
| + 'devrel', '--neigh', 'end'])); |
| + }); |
| + |
| + test('with continueParsing, continues parsing when non-option-like' |
| + ' arg is encountered', () { |
| + var parser = new ArgParser(); |
| + parser.addFlag('woof'); |
| + parser.addFlag('neigh'); |
| + parser.addOption('meow'); |
| + parser.addOption('tweet', defaultsTo: 'bird'); |
| + |
| + var results = parser.parse(['--woof', '--meow', 'v', 'not', 'option', |
| + '--tweet', 'devrel', '--neigh', 'end' ], |
| + continueParsing: true); |
| + expect(results['woof'], isTrue); |
| + expect(results['neigh'], isTrue); |
| + expect(results['meow'], equals('v')); |
| + expect(results['tweet'], equals('devrel')); |
| + expect(results.rest, orderedEquals(['not', 'option', 'end'])); |
| }); |
| test('stops parsing at "--"', () { |