From b4bd124be496170937d19742d83c2bad7471fe81 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 7 Jan 2022 17:01:10 -0500 Subject: QPDFArgParser: support adding/printing help information --- libtests/qtest/arg_parser.test | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'libtests/qtest/arg_parser.test') 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)); -- cgit v1.2.3-70-g09d2