Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MooseX-Getopt-Usage CPAN distribution.

Report information
The Basics
Id: 85348
Status: resolved
Priority: 0/
Queue: MooseX-Getopt-Usage

People
Owner: PITCHLESS [...] cpan.org
Requestors: chisel [...] chizography.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.11
Fixed in: 0.14



Subject: Tests fail on system using non /usr/bin/env perl

Message body is not shown because it is too large.

Subject: [PATCH] Tests fail on when using perl other than /usr/bin/perl
Attached is a patch that uses the same perl to run the scripts as to run the tests. It also fixes running the tests in a directory with spaces in the name.
Subject: mx-getopt-usage.diff
--- a/t/lib/Bin/Test.pm 2013-05-02 21:47:57.000000000 +0100 +++ b/t/lib/Bin/Test.pm 2013-05-16 10:52:42.544455269 +0100 @@ -35,8 +35,9 @@ sub capture_ok { my ($cmd, $stdout_ok, $stderr_ok, $testmsg) = @_; + my ($script, @args) = @{$cmd}; my $msg = $testmsg ? " - $testmsg" : ""; - my ($stdout, $stderr) = capture { system("$TBin/$cmd") }; + my ($stdout, $stderr) = capture { system($^X, "$TBin/$script", @args) }; eq_or_diff $stdout, $stdout_ok, "$cmd STDOUT$msg"; eq_or_diff $stderr, $stderr_ok, "$cmd STDERR$msg"; } @@ -50,7 +51,7 @@ skip "No $ok_file to test with", 2 unless -f $ok_file; my $stdout_ok = slurp($ok_file); - capture_ok( "$cmd --usage", $stdout_ok, "" ); + capture_ok( [$cmd, "--usage"], $stdout_ok, "" ); } $ok_file = "$Bin/bin.ok/$cmd.man.ok"; @@ -58,7 +59,7 @@ skip "No $ok_file to test with", 2 unless -f $ok_file; my $stdout_ok = slurp($ok_file); - capture_ok( "$cmd --man", $stdout_ok, "" ); + capture_ok( [$cmd, "--man"], $stdout_ok, "" ); } } @@ -68,7 +69,7 @@ my $stdout_ok = slurp("$Bin/bin.ok/basic.usage.ok"); foreach my $flag (qw/-? --help --usage/) { - capture_ok( "basic $flag", $stdout_ok, "" ); + capture_ok( [basic => $flag], $stdout_ok, "" ); } } --- a/t/lib/Basic/Test.pm 2013-05-02 21:47:57.000000000 +0100 +++ b/t/lib/Basic/Test.pm 2013-05-16 10:46:56.655677698 +0100 @@ -15,9 +15,10 @@ sub cmd_stdout_like { my $cmd = shift; my $re = shift; - my $tname = shift || "$cmd; stdout like $re"; + my $tname = shift || "@$cmd; stdout like $re"; + my ($script, @args) = @{$cmd}; - my ($stdout, $stderr) = capture { system("$TBin/$cmd") }; + my ($stdout, $stderr) = capture { system($^X, "$TBin/$script", @args) }; like $stdout, $re, $tname; } @@ -59,9 +60,9 @@ sub cmd_line_errors : Tests(2) { my $self = shift; - cmd_stdout_like 'basic --notanoption', + cmd_stdout_like [qw'basic --notanoption'], qr/^Unknown option: notanoption\nUsage/; - cmd_stdout_like 'basic --verbose=2', + cmd_stdout_like [qw'basic --verbose=2'], qr/^Option verbose does not take an argument\nUsage/; # TODO : Test all the error traps and test status code.
On Thu May 16 05:58:15 2013, ilmari wrote: Show quoted text
> Attached is a patch that uses the same perl to run the scripts as to > run the tests. It also fixes running the tests in a directory with > spaces in the name.
Hi Ilmari, Many thanks for this, apologies I'm a little slow on checking the cpan RT. I had been fighting this problem my self as it was causing a lot of cpan testers fails. I have the fix for perl version in the current dev release. Basically your fix but using this to get the perl binary: use Config; our $PerlPath = $Config{perlpath}; As advised here: http://wiki.cpantesters.org/wiki/CPANAuthorNotes I'd not spotted that problem for spaces in the name (hangs head!), I'll get this integrated as well and do a full release soon. Nice to know there are people out there using the module. Cheers, mark
Fixed in version 0.14, pushed to CPAN. Thanks for the report and patch.