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

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

Issue 23913009: Add support for hidden options to pkg/args. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/lib/args.dart ('K') | « pkg/args/lib/src/usage.dart ('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 main() { 10 main() {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 validateUsage(parser, 160 validateUsage(parser,
161 ''' 161 '''
162 --suit Like in cards 162 --suit Like in cards
163 163
164 [clubs] Weapons of war 164 [clubs] Weapons of war
165 [diamonds] Money for this art 165 [diamonds] Money for this art
166 [hearts] The shape of my heart 166 [hearts] The shape of my heart
167 [spades] Swords of a soldier 167 [spades] Swords of a soldier
168 '''); 168 ''');
169 }); 169 });
170
171 test("hidden flags don't appear in the help", () {
172 var parser = new ArgParser();
173 parser.addOption('first', help: 'The first option');
174 parser.addOption('second', isHidden: true);
175 parser.addOption('third', help: 'The third option');
176
177
178 validateUsage(parser,
179 '''
180 --first The first option
181 --third The third option
182 ''');
183 });
170 }); 184 });
171 } 185 }
172 186
173 throwsIllegalArg(function) { 187 throwsIllegalArg(function) {
174 expect(function, throwsArgumentError); 188 expect(function, throwsArgumentError);
175 } 189 }
176 190
177 validateUsage(ArgParser parser, String expected) { 191 validateUsage(ArgParser parser, String expected) {
178 expected = unindentString(expected); 192 expected = unindentString(expected);
179 expect(parser.getUsage(), equals(expected)); 193 expect(parser.getUsage(), equals(expected));
(...skipping 26 matching lines...) Expand all
206 throw new ArgumentError( 220 throw new ArgumentError(
207 'Line "$line" does not have enough indentation.'); 221 'Line "$line" does not have enough indentation.');
208 } 222 }
209 223
210 lines[i] = line.substring(indent); 224 lines[i] = line.substring(indent);
211 } 225 }
212 } 226 }
213 227
214 return lines.join('\n'); 228 return lines.join('\n');
215 } 229 }
OLDNEW
« pkg/args/lib/args.dart ('K') | « pkg/args/lib/src/usage.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698