diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-01-07 23:01:10 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-01-30 19:11:03 +0100 |
commit | b4bd124be496170937d19742d83c2bad7471fe81 (patch) | |
tree | 0cd998483de30c688cf5130c90fd4ee94f47833c /libtests/qtest/arg_parser.test | |
parent | 5303130cf920ad9242bd1bb5ad998a791eb7e205 (diff) | |
download | qpdf-b4bd124be496170937d19742d83c2bad7471fe81.tar.zst |
QPDFArgParser: support adding/printing help information
Diffstat (limited to 'libtests/qtest/arg_parser.test')
-rw-r--r-- | libtests/qtest/arg_parser.test | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libtests/qtest/arg_parser.test b/libtests/qtest/arg_parser.test index 1d24d507..5079289a 100644 --- a/libtests/qtest/arg_parser.test +++ b/libtests/qtest/arg_parser.test @@ -101,4 +101,30 @@ $td->runtest("args from stdin", {$td->FILE => "stdin.out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); -$td->report(2 + (2 * scalar(@completion_tests)) + scalar(@arg_tests)); +my @help_tests = ( + '', + '=all', + '=--ewe', + '=quack', + ); +foreach my $i (@help_tests) +{ + my $out = $i; + $out =~ s/[=-]//g; + if ($out ne '') + { + $out = "-$out"; + } + $td->runtest("--help$i", + {$td->COMMAND => "arg_parser --help$i"}, + {$td->FILE => "help$out.out", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); +} + +$td->runtest("bad help option", + {$td->COMMAND => 'arg_parser --help=--oops'}, + {$td->FILE => "help-bad.out", $td->EXIT_STATUS => 2}, + $td->NORMALIZE_NEWLINES); + +$td->report(3 + (2 * scalar(@completion_tests)) + + scalar(@arg_tests) + scalar(@help_tests)); |