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

Unified Diff: pkg/args/test/args_test.dart

Issue 10947044: Commit patch: https://codereview.chromium.org/10914320/ (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/args/lib/args.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/test/args_test.dart
diff --git a/pkg/args/test/args_test.dart b/pkg/args/test/args_test.dart
index e1a4d4374448906835eaa280da07831f7a0f7e1d..1de7877aab0ed14c19cb18103555e10677b137a2 100644
--- a/pkg/args/test/args_test.dart
+++ b/pkg/args/test/args_test.dart
@@ -189,6 +189,50 @@ main() {
var args = parser.parse([]);
expect(a, isNull);
});
+
+ test('for multiple present, allowMultiple, options are invoked with '
+ 'value as a list', () {
+ var a;
+ var parser = new ArgParser();
+ parser.addOption('a', allowMultiple: true,
+ callback: (value) => a = value);
+
+ var args = parser.parse(['--a=v', '--a=x']);
+ expect(a, equals(['v', 'x']));
+ });
+
+ test('for single present, allowMultiple, options are invoked with '
+ ' value as a single element list', () {
+ var a;
+ var parser = new ArgParser();
+ parser.addOption('a', allowMultiple: true,
+ callback: (value) => a = value);
+
+ var args = parser.parse(['--a=v']);
+ expect(a, equals(['v']));
+ });
+
+ test('for absent, allowMultiple, options are invoked with default '
+ 'value as a list.', () {
+ var a;
+ var parser = new ArgParser();
+ parser.addOption('a', allowMultiple: true, defaultsTo: 'v',
+ callback: (value) => a = value);
+
+ var args = parser.parse([]);
+ expect(a, equals(['v']));
+ });
+
+ test('for absent, allowMultiple, options are invoked with value '
+ 'as an empty list.', () {
+ var a;
+ var parser = new ArgParser();
+ parser.addOption('a', allowMultiple: true,
+ callback: (value) => a = value);
+
+ var args = parser.parse([]);
+ expect(a, isEmpty);
+ });
});
group('abbreviations', () {
« no previous file with comments | « pkg/args/lib/args.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698