git.shiar.nl
/
barcat.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1de6020
)
adjust example commands for testing
author
Mischa POSLAWSKY
<perl@shiar.org>
Sat, 13 Mar 2021 03:59:43 +0000
(
04:59
+0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Mon, 18 Apr 2022 09:04:29 +0000
(11:04 +0200)
t/examples.t
patch
|
blob
|
history
diff --git
a/t/examples.t
b/t/examples.t
index 19c1377821983d7715e1aa62adde46a3c6cc43ed..cd7f1b37edef4281c600b05efbe3c9b0746dfb20 100755
(executable)
--- a/
t/examples.t
+++ b/
t/examples.t
@@
-3,6
+3,12
@@
use 5.014;
use warnings;
use Test::More;
use warnings;
use Test::More;
+my %CMDARGS = (
+ ping => '-c 1',
+ curl => '-sS',
+ 'cat \Klog/' => '/var/log/apache2/',
+);
+
my $filename = 'barcat';
open my $input, '<', $filename
or die "Cannot read documentation from $filename script\n";
my $filename = 'barcat';
open my $input, '<', $filename
or die "Cannot read documentation from $filename script\n";
@@
-14,7
+20,13
@@
while (readline $input) {
chomp;
my ($name) = /[\h(]*([^|]+)/;
chomp;
my ($name) = /[\h(]*([^|]+)/;
- ok(qx($_), $name);
+
+ my $cmd = $_;
+ while (my ($subcmd, $args) = each %CMDARGS) {
+ $subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
+ $cmd =~ s/\b$subcmd/$args/;
+ }
+ ok(qx($cmd), $name);
}
done_testing();
}
done_testing();