| Index: test/usage_test.dart
|
| diff --git a/test/usage_test.dart b/test/usage_test.dart
|
| index 2c44ec36d21bec78e5d1d9fd3395421286addd28..e7f3e4779a0738d23bbd1cf204cd945f72435948 100644
|
| --- a/test/usage_test.dart
|
| +++ b/test/usage_test.dart
|
| @@ -13,8 +13,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addFlag('mode', help: 'The mode');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]mode The mode
|
| ''');
|
| });
|
| @@ -23,8 +22,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addFlag('mode', negatable: false, help: 'The mode');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --mode The mode
|
| ''');
|
| });
|
| @@ -33,8 +31,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addFlag('mode', help: 'The mode');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]mode The mode
|
| ''');
|
| });
|
| @@ -44,8 +41,7 @@ void main() {
|
| parser.addFlag('mode', abbr: 'm', help: 'The mode');
|
| parser.addOption('long', help: 'Lacks an abbreviation');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| -m, --[no-]mode The mode
|
| --long Lacks an abbreviation
|
| ''');
|
| @@ -56,8 +52,7 @@ void main() {
|
| parser.addFlag('mode', abbr: 'm', help: 'Lined up with below');
|
| parser.addOption('a-really-long-name', help: 'Its help text');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| -m, --[no-]mode Lined up with below
|
| --a-really-long-name Its help text
|
| ''');
|
| @@ -67,8 +62,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addFlag('mode', help: '\n\n\n\nAfter newlines');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]mode After newlines
|
| ''');
|
| });
|
| @@ -77,8 +71,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addFlag('mode', help: 'Before newlines\n\n\n\n');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]mode Before newlines
|
| ''');
|
| });
|
| @@ -89,8 +82,7 @@ void main() {
|
| parser.addFlag('monkey', help: 'Second');
|
| parser.addFlag('wombat', help: 'Third');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]zebra First
|
| --[no-]monkey Second
|
| --[no-]wombat Third
|
| @@ -102,8 +94,7 @@ void main() {
|
| parser.addFlag('affirm', help: 'Should be on', defaultsTo: true);
|
| parser.addFlag('negate', help: 'Should be off', defaultsTo: false);
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]affirm Should be on
|
| (defaults to on)
|
|
|
| @@ -115,8 +106,7 @@ void main() {
|
| var parser = new ArgParser();
|
| parser.addOption('any', help: 'Can be anything', defaultsTo: 'whatevs');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --any Can be anything
|
| (defaults to "whatevs")
|
| ''');
|
| @@ -124,22 +114,21 @@ void main() {
|
|
|
| test('the value help is shown', () {
|
| var parser = new ArgParser();
|
| - parser.addOption('out', abbr: 'o', help: 'Where to write file',
|
| - valueHelp: 'path');
|
| + parser.addOption('out',
|
| + abbr: 'o', help: 'Where to write file', valueHelp: 'path');
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| -o, --out=<path> Where to write file
|
| ''');
|
| });
|
|
|
| test('the allowed list is shown', () {
|
| var parser = new ArgParser();
|
| - parser.addOption('suit', help: 'Like in cards',
|
| + parser.addOption('suit',
|
| + help: 'Like in cards',
|
| allowed: ['spades', 'clubs', 'hearts', 'diamonds']);
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --suit Like in cards
|
| [spades, clubs, hearts, diamonds]
|
| ''');
|
| @@ -147,11 +136,12 @@ void main() {
|
|
|
| test('the default is highlighted in the allowed list', () {
|
| var parser = new ArgParser();
|
| - parser.addOption('suit', help: 'Like in cards', defaultsTo: 'clubs',
|
| + parser.addOption('suit',
|
| + help: 'Like in cards',
|
| + defaultsTo: 'clubs',
|
| allowed: ['spades', 'clubs', 'hearts', 'diamonds']);
|
|
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --suit Like in cards
|
| [spades, clubs (default), hearts, diamonds]
|
| ''');
|
| @@ -159,17 +149,18 @@ void main() {
|
|
|
| test('the allowed help is shown', () {
|
| var parser = new ArgParser();
|
| - parser.addOption('suit', help: 'Like in cards', defaultsTo: 'clubs',
|
| + parser.addOption('suit',
|
| + help: 'Like in cards',
|
| + defaultsTo: 'clubs',
|
| allowed: ['spades', 'clubs', 'diamonds', 'hearts'],
|
| allowedHelp: {
|
| - 'spades': 'Swords of a soldier',
|
| - 'clubs': 'Weapons of war',
|
| - 'diamonds': 'Money for this art',
|
| - 'hearts': 'The shape of my heart'
|
| - });
|
| -
|
| - validateUsage(parser,
|
| - '''
|
| + 'spades': 'Swords of a soldier',
|
| + 'clubs': 'Weapons of war',
|
| + 'diamonds': 'Money for this art',
|
| + 'hearts': 'The shape of my heart'
|
| + });
|
| +
|
| + validateUsage(parser, '''
|
| --suit Like in cards
|
|
|
| [clubs] Weapons of war
|
| @@ -185,9 +176,7 @@ void main() {
|
| parser.addOption('second', hide: true);
|
| parser.addOption('third', help: 'The third option');
|
|
|
| -
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --first The first option
|
| --third The third option
|
| ''');
|
| @@ -199,9 +188,7 @@ void main() {
|
| parser.addFlag('second', hide: true);
|
| parser.addFlag('third', help: 'The third flag');
|
|
|
| -
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]first The first flag
|
| --[no-]third The third flag
|
| ''');
|
| @@ -213,9 +200,7 @@ void main() {
|
| parser.addFlag('second-very-long-option', hide: true);
|
| parser.addFlag('third', help: 'The third flag');
|
|
|
| -
|
| - validateUsage(parser,
|
| - '''
|
| + validateUsage(parser, '''
|
| --[no-]first The first flag
|
| --[no-]third The third flag
|
| ''');
|
|
|