From 79e274d4b82a711e4aa3c78867b220bf96509463 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Sun, 19 May 2024 17:42:31 +0200 Subject: [PATCH] test help output during normal option parsing The existing test for "fping -h" triggers the special code path for only one option, either -h or --help, that is handled before normal option parsing. --- ci/test-02-help.pl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ci/test-02-help.pl b/ci/test-02-help.pl index 19c6741..5a146fb 100755 --- a/ci/test-02-help.pl +++ b/ci/test-02-help.pl @@ -1,11 +1,11 @@ #!/usr/bin/perl -w -use Test::Command tests => 9; +use Test::Command tests => 12; my $I_HELP = " -I, --iface=IFACE bind to a particular interface\n"; $I_HELP = '' if $^O eq 'darwin'; -# fping -h +# fping -h (special pre-parse code path) my $cmd1 = Test::Command->new(cmd => "fping -h"); $cmd1->exit_is_num(0); $cmd1->stdout_like(qr{Usage: fping \[options\] \[targets\.\.\.\] @@ -16,6 +16,17 @@ Probing options: }s); $cmd1->stderr_is_eq(""); +# fping -4 -h (normal option parsing code path) +my $cmd4 = Test::Command->new(cmd => "fping -4 -h"); +$cmd4->exit_is_num(0); +$cmd4->stdout_like(qr{Usage: fping \[options\] \[targets\.\.\.\] + +Probing options: +.* + -v, --version show version +}s); +$cmd4->stderr_is_eq(""); + # fping -v my $cmd2 = Test::Command->new(cmd => "fping -v"); $cmd2->exit_is_num(0);