Skip to content

Commit

Permalink
Test examples from man page
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
auerswal committed Jan 8, 2024
1 parent 37b111f commit 035ed2b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ci/test-05-options-c-e.pl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 035ed2b

Please sign in to comment.