Debian Codegraph @

ci/test-02-help.pl

raw
1 #!/usr/bin/perl -w
2
3 use Test::Command tests => 9;
4
5 my $I_HELP = " -I, --iface=IFACE bind to a particular interface\n";
6 $I_HELP = '' if $^O eq 'darwin';
7
8 # fping -h
9 my $cmd1 = Test::Command->new(cmd => "fping -h");
10 $cmd1->exit_is_num(0);
11 $cmd1->stdout_like(qr{Usage: fping \[options\] \[targets\.\.\.\]
12
13 Probing options:
14 .*
15 -v, --version show version
16 }s);
17 $cmd1->stderr_is_eq("");
18
19 # fping -v
20 my $cmd2 = Test::Command->new(cmd => "fping -v");
21 $cmd2->exit_is_num(0);
22 $cmd2->stdout_like(qr{fping: Version \S+});
23 $cmd2->stderr_is_eq("");
24
25 # fping with unknown option
26 my $cmd3 = Test::Command->new(cmd => "fping -Z");
27 $cmd3->exit_is_num(1);
28 $cmd3->stdout_is_eq("");
29 $cmd3->stderr_like(qr{^fping: (illegal|invalid) option -- '?Z'?\nsee 'fping -h' for usage information\n$});