diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-12-23 16:45:24 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-12-23 17:21:59 +0100 |
commit | 64c1579544daef83af1494aa16ee6bc081347d39 (patch) | |
tree | 7f14d2de61748107305f3ce40374591235fdb8db /qpdf/qtest/qpdf.test | |
parent | 2e306d32494bede29b995f34cacafd9d28b94500 (diff) | |
download | qpdf-64c1579544daef83af1494aa16ee6bc081347d39.tar.zst |
Support zsh completion
Diffstat (limited to 'qpdf/qtest/qpdf.test')
-rw-r--r-- | qpdf/qtest/qpdf.test | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index f2f0579f..7fa6f18f 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -116,6 +116,7 @@ my @completion_tests = ( ['qpdf --decode-l', undef, 'decode-l'], ['qpdf --decode-lzzz', 15, 'decode-l'], ['qpdf --decode-level=', undef, 'decode-level'], + ['qpdf --decode-level=g', undef, 'decode-level-g'], ['qpdf --check -', undef, 'later-arg'], ['qpdf infile outfile oops --ch', undef, 'usage-empty'], ['qpdf --encrypt \'user " password\' ', undef, 'quoting'], @@ -124,16 +125,26 @@ my @completion_tests = ( ['qpdf --encrypt "user pass\'word" ', undef, 'quoting'], ['qpdf --encrypt user\ password ', undef, 'quoting'], ); -$n_tests += scalar(@completion_tests); +$n_tests += 2 * scalar(@completion_tests); foreach my $c (@completion_tests) { my ($cmd, $point, $description) = @$c; my $out = "completion-$description.out"; + my $zout = "completion-$description-zsh.out"; + if (! -f $zout) + { + $zout = $out; + } $td->runtest("bash completion: $description", {$td->COMMAND => [@{bash_completion($cmd, $point)}], $td->FILTER => "perl filter-completion.pl $out"}, {$td->FILE => "$out", $td->EXIT_STATUS => 0}, $td->NORMALIZE_NEWLINES); + $td->runtest("zsh completion: $description", + {$td->COMMAND => [@{zsh_completion($cmd, $point)}], + $td->FILTER => "perl filter-completion.pl $zout"}, + {$td->FILE => "$zout", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); } show_ntests(); @@ -3208,6 +3219,16 @@ sub bash_completion "qpdf", $this, $cur, $prev]; } +sub zsh_completion +{ + my ($line, $point) = @_; + if (! defined $point) + { + $point = length($line); + } + ['env', "COMP_LINE=$line", "COMP_POINT=$point", "qpdf"]; +} + sub check_pdf { my ($description, $command, $output, $status) = @_; |