Skip Menu |

This queue is for tickets about the Test-Script-Run CPAN distribution.

Report information
The Basics
Id: 89629
Status: resolved
Priority: 0/
Queue: Test-Script-Run

People
Owner: Nobody in particular
Requestors: DKOGAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.08



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) {
Hi Dima included in 0.08, thanks! Regards sunnavy On Sat Oct 19 19:57:27 2013, DKOGAN wrote: Show quoted text
> 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