String-ShellQuote
view release on metacpan or search on metacpan
sub test {
my ($want, @args) = @_;
my $pid = $$;
my $got = eval { &$testsub(@args) };
exit if $$ != $pid;
if ($@) {
chomp $@;
$@ =~ s/ at \S+ line \d+\.?\z//;
$got = "die: $@";
}
my $from_line = (caller)[2];
ok $got eq $want,
qq{line $from_line\n# wanted [$want]\n# got [$got]};
}
$testsub = \&shell_quote;
test '';
test q{''}, '';
test q{''}, undef;
test q{foo}, qw(foo);
test q{foo bar}, qw(foo bar);
( run in 1.342 second using v1.01-cache-2.11-cpan-a3c8064c92c )