From 2a609b856d1aa796690d13ff4e9e1433334e1301 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Mon, 8 Jan 2024 09:35:49 +0100 Subject: [PATCH] Test examples from man page The man page gives two examples combining -C and -q, but these combinations are not yet tested. Add tests to help ensure the documented examples continue to work. --- ci/test-05-options-c-e.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ci/test-05-options-c-e.pl b/ci/test-05-options-c-e.pl index 7c3b0ac1..7bbe68c7 100755 --- a/ci/test-05-options-c-e.pl +++ b/ci/test-05-options-c-e.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -use Test::Command tests => 12; +use Test::Command tests => 18; # -c n count of pings to send to each target (default 1) # -C n same as -c, report results in verbose format @@ -37,6 +37,25 @@ }); } +# fping -C n -q +{ +my $cmd = Test::Command->new(cmd => "fping -C 5 -q -p 100 localhost"); +$cmd->exit_is_num(0); +$cmd->stdout_is_eq(""); +$cmd->stderr_like(qr{localhost :( \d\.\d+){5} +}); +} + +# fping -C n -i -q +{ +my $cmd = Test::Command->new(cmd => "fping --quiet --interval=1 --vcount=20 --period=50 127.0.0.1 127.0.0.2"); +$cmd->exit_is_num(0); +$cmd->stdout_is_eq(""); +$cmd->stderr_like(qr{127\.0\.0\.1 :( \d\.\d+){20} +127\.0\.0\.2 :( \d\.\d+){20} +}); +} + # fping -D { my $cmd = Test::Command->new(cmd => "fping -D -c 2 -p 100 127.0.0.1");