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

Unified Diff: tests/lib/args/args_test.dart

Issue 10756011: Have Pub make use of the arg parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests for non-negatable flags. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/args/args.dart ('k') | utils/pub/pub.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/args/args_test.dart
diff --git a/tests/lib/args/args_test.dart b/tests/lib/args/args_test.dart
index 18f0388565239ab3d78242d7ff9156a8966a8f94..f8cb3906ab1c31d98f2d96f49305d56a5bbc2e37 100644
--- a/tests/lib/args/args_test.dart
+++ b/tests/lib/args/args_test.dart
@@ -122,6 +122,13 @@ main() {
expect(args['no-strum'], isTrue);
expect(args['strum'], isFalse);
});
+
+ test('fail for non-negatable flags', () {
+ var parser = new ArgParser();
+ parser.addFlag('strum', negatable: false);
+
+ throwsBadFormat(parser, ['--no-strum']);
+ });
});
group('callbacks', () {
@@ -380,7 +387,7 @@ main() {
});
group('ArgParser.getUsage()', () {
- test('flags show "no-" in title', () {
+ test('negatable flags show "no-" in title', () {
var parser = new ArgParser();
parser.addFlag('mode', help: 'The mode');
@@ -390,6 +397,16 @@ main() {
''');
});
+ test('non-negatable flags don\'t show "no-" in title', () {
+ var parser = new ArgParser();
+ parser.addFlag('mode', negatable: false, help: 'The mode');
+
+ validateUsage(parser,
+ '''
+ --mode The mode
+ ''');
+ });
+
test('if there are no abbreviations, there is no column for them', () {
var parser = new ArgParser();
parser.addFlag('mode', help: 'The mode');
« no previous file with comments | « lib/args/args.dart ('k') | utils/pub/pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698