Subject: | Test::Script::Run prints out unquoted strings for its shell commands |
When using is_script_output() Test::Script::Run prints out the command being run. The string being printed out is unquoted, however, so it's not always possible to paste the command into the shell to debug a test failure. A common case when this happens is if any of the @args contains a space.
I'm attaching a patch to fix this. This patch uses a CPAN module to do the quoting: String::ShellQuote.
Thanks
Subject: | libtest-script-run---shell-quote.patch |
diff --git a/lib/Test/Script/Run.pm b/lib/Test/Script/Run.pm
index ed0f1d3..93f52eb 100644
--- a/lib/Test/Script/Run.pm
+++ b/lib/Test/Script/Run.pm
@@ -7,6 +7,7 @@ use Test::Exception;
use IPC::Run3;
use File::Basename;
use File::Spec;
+use String::ShellQuote;
our $VERSION = '0.05';
use base 'Exporter';
@@ -326,7 +327,7 @@ sub _check_cmp_closure_output {
push @$stdout_err, "got nothing, expected: $line";
}
- my $test_name = join( ' ', $msg ? "$msg:" : '', $script, @$args );
+ my $test_name = join( ' ', $msg ? "$msg:" : '', $script, shell_quote(@$args) );
is( scalar(@$stdout_err), 0, $test_name );
if (@$stdout_err) {