+ # compose an identifier from significant parts
+ do {
+ s/^\h+//; # indentation
+ s/\\\n\s*//g; # line continuations
+ s/^[(\h]+//; # subshell
+ s/^echo\ .*?\|\s*//; # preceding input
+ s/\|.*//; # subsequent pipes
+ s/^cat\ //; # local file
+ s/^curl\ // and do { # remote url
+ s/\ -.+//g; # download options
+ s{//[^/\s]+/\K\S*(?=/)}{}; # subdirectories
+ s{^https?://}{}; # http protocol
+ };
+ } for my $name = $_;
+
+ # prepare shell command to execute
+ my $cmd = $_;
+ while (my ($subcmd, $args) = each %CMDARGS) {
+ $subcmd .= " \\K", $args .= ' ' unless $subcmd =~ m/\\K/;
+ $cmd =~ s/\b$subcmd/$args/;
+ }
+ my @cmd = (bash => -c => "set -o pipefail\n$cmd");
+
+ # run and report unexpected results
+ ok(eval {
+ run(\@cmd, \undef, \my $output, \my $error);
+ die("error message:\n $error\n") if $error;
+ $? == 0 or die "exit status ", $? >> 8, "\n";
+ length $output or die "empty output\n";
+ return 1;
+ }, $name) or diag("Failed command\n@cmd\nfrom $filename line $.: $@");