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

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

Issue 363083002: Allow defining a help string for an option's parameter value. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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
« pkg/args/README.md ('K') | « pkg/args/pubspec.yaml ('k') | 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
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 usage_test; 5 library usage_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 void main() { 10 void main() {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 var parser = new ArgParser(); 115 var parser = new ArgParser();
116 parser.addOption('any', help: 'Can be anything', defaultsTo: 'whatevs'); 116 parser.addOption('any', help: 'Can be anything', defaultsTo: 'whatevs');
117 117
118 validateUsage(parser, 118 validateUsage(parser,
119 ''' 119 '''
120 --any Can be anything 120 --any Can be anything
121 (defaults to "whatevs") 121 (defaults to "whatevs")
122 '''); 122 ''');
123 }); 123 });
124 124
125 test('the value help is shown', () {
126 var parser = new ArgParser();
127 parser.addOption('out', abbr: 'o', help: 'Where to write file',
128 valueHelp: 'path');
129
130 validateUsage(parser,
131 '''
132 -o, --out=<path> Where to write file
133 ''');
134 });
135
125 test('the allowed list is shown', () { 136 test('the allowed list is shown', () {
126 var parser = new ArgParser(); 137 var parser = new ArgParser();
127 parser.addOption('suit', help: 'Like in cards', 138 parser.addOption('suit', help: 'Like in cards',
128 allowed: ['spades', 'clubs', 'hearts', 'diamonds']); 139 allowed: ['spades', 'clubs', 'hearts', 'diamonds']);
129 140
130 validateUsage(parser, 141 validateUsage(parser,
131 ''' 142 '''
132 --suit Like in cards 143 --suit Like in cards
133 [spades, clubs, hearts, diamonds] 144 [spades, clubs, hearts, diamonds]
134 '''); 145 ''');
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 throw new ArgumentError( 255 throw new ArgumentError(
245 'Line "$line" does not have enough indentation.'); 256 'Line "$line" does not have enough indentation.');
246 } 257 }
247 258
248 lines[i] = line.substring(indent); 259 lines[i] = line.substring(indent);
249 } 260 }
250 } 261 }
251 262
252 return lines.join('\n'); 263 return lines.join('\n');
253 } 264 }
OLDNEW
« pkg/args/README.md ('K') | « pkg/args/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698