r59796 - in /branches/upstream/libtest-script-run-perl/current: Changes MANIFEST META.yml lib/Test/Script/Run.pm t/01.run.t t/script/ t/script/test_script.pl

christine at users.alioth.debian.org christine at users.alioth.debian.org
Sat Jun 26 03:08:27 UTC 2010


Author: christine
Date: Sat Jun 26 03:06:48 2010
New Revision: 59796

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59796
Log:
[svn-upgrade] Integrating new upstream version, libtest-script-run-perl (0.04)

Added:
    branches/upstream/libtest-script-run-perl/current/t/script/
    branches/upstream/libtest-script-run-perl/current/t/script/test_script.pl
Modified:
    branches/upstream/libtest-script-run-perl/current/Changes
    branches/upstream/libtest-script-run-perl/current/MANIFEST
    branches/upstream/libtest-script-run-perl/current/META.yml
    branches/upstream/libtest-script-run-perl/current/lib/Test/Script/Run.pm
    branches/upstream/libtest-script-run-perl/current/t/01.run.t

Modified: branches/upstream/libtest-script-run-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/Changes?rev=59796&op=diff
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/Changes (original)
+++ branches/upstream/libtest-script-run-perl/current/Changes Sat Jun 26 03:06:48 2010
@@ -1,6 +1,10 @@
 Revision history for Test-Script-Run
 
-0.03
+0.04 Fri Jun 25 12:01:30 CST 2010
+
+    allow customization of bin dir names.
+
+0.03 Tue Nov 17 01:50:40 GMT 2009
     Make get_perl_cmd public API
     Strip references from @INC when generating a perl command
 

Modified: branches/upstream/libtest-script-run-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/MANIFEST?rev=59796&op=diff
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-script-run-perl/current/MANIFEST Sat Jun 26 03:06:48 2010
@@ -21,6 +21,7 @@
 t/bin/test.pl
 t/bin/test_die.pl
 t/sbin/test_sbin.pl
+t/script/test_script.pl
 xt/kwalitee.t
 xt/perlcritic.t
 xt/pod-coverage.t

Modified: branches/upstream/libtest-script-run-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/META.yml?rev=59796&op=diff
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/META.yml (original)
+++ branches/upstream/libtest-script-run-perl/current/META.yml Sat Jun 26 03:06:48 2010
@@ -20,4 +20,4 @@
   Test::Exception: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.03
+version: 0.04

Modified: branches/upstream/libtest-script-run-perl/current/lib/Test/Script/Run.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/lib/Test/Script/Run.pm?rev=59796&op=diff
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/lib/Test/Script/Run.pm (original)
+++ branches/upstream/libtest-script-run-perl/current/lib/Test/Script/Run.pm Sat Jun 26 03:06:48 2010
@@ -8,7 +8,7 @@
 use File::Basename;
 use File::Spec;
 
-our $VERSION = '0.03';
+our $VERSION = '0.04';
 use base 'Exporter';
 our @EXPORT =
   qw/run_ok run_not_ok run_script run_output_matches run_output_matches_unordered/;
@@ -20,6 +20,8 @@
     $last_script_exit_code,
 );
 
+our @BIN_DIRS = ('bin','sbin','script');
+
 =head1 NAME
 
 Test::Script::Run - test the script with run
@@ -27,6 +29,8 @@
 =head1 SYNOPSIS
 
     use Test::Script::Run;
+    # customized names of bin dirs, default is qw/bin sbin script/;
+    @Test::Script::Run::BIN_DIRS = qw/bin/;
     run_ok( 'app_name', [ app's args ], 'you_app runs ok' );
     my ( $return, $stdout, $stderr ) = run_script( 'app_name', [ app's args ] );
     run_output_matches(
@@ -168,12 +172,20 @@
     if (defined $script) {
         unless ( File::Spec->file_name_is_absolute($script) ) {
             my ( $tmp, $i ) = ( _updir($0), 0 );
-            while ( !-d File::Spec->catdir( $tmp, 'bin' ) && $i++ < 10 ) {
+            my $found;
+LOOP:
+            while ( $i++ < 10 ) {
+                for my $bin ( @BIN_DIRS ) {
+                    if ( -e File::Spec->catfile( $tmp, $bin, $script ) ) {
+                        $script = File::Spec->catfile( $tmp, $bin, $script );
+                        $found = 1;
+                        last LOOP;
+                    }
+                }
                 $tmp = _updir($tmp);
             }
 
-            $base_dir = File::Spec->catdir( $tmp, 'bin' );
-            die "couldn't find bin dir" unless -d $base_dir;
+            warn "couldn't find the script" unless $found;
         }
     }
 
@@ -187,7 +199,7 @@
     }
 
     if (defined $script) {
-        push @cmd, $base_dir ? File::Spec->catdir( $base_dir => $script ) : $script;
+        push @cmd, $script;
         push @cmd, @_;
     }
 

Modified: branches/upstream/libtest-script-run-perl/current/t/01.run.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/t/01.run.t?rev=59796&op=diff
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/t/01.run.t (original)
+++ branches/upstream/libtest-script-run-perl/current/t/01.run.t Sat Jun 26 03:06:48 2010
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 33;
+use Test::More tests => 38;
 use Test::Script::Run ':all';
 use File::Spec;
 
@@ -79,3 +79,15 @@
 ok( $return, 'return of sbin_script' );
 is( $stdout, 'test_sbin_script', 'stdout of sbin_script' );
 
+
+run_ok( 'test_script.pl', 'run test_script.pl' );
+is( last_script_stdout, "out line 1\nout line 2", 'last stdout' );
+is( last_script_stderr, "err line 1\nerr line 2", 'last stderr' );
+is( last_script_exit_code, 0, 'last exit code' );
+
+is_script_output(
+    'test.pl', ['out', 'err'],
+    [ 'out' ],
+    [ 'err' ],
+    'is_script_output'
+);

Added: branches/upstream/libtest-script-run-perl/current/t/script/test_script.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-script-run-perl/current/t/script/test_script.pl?rev=59796&op=file
==============================================================================
--- branches/upstream/libtest-script-run-perl/current/t/script/test_script.pl (added)
+++ branches/upstream/libtest-script-run-perl/current/t/script/test_script.pl Sat Jun 26 03:06:48 2010
@@ -1,0 +1,7 @@
+use strict;
+use warnings;
+
+my ( $out, $err ) = @ARGV;
+print $out || "out line 1\nout line 2";
+print STDERR $err || "err line 1\nerr line 2";
+




More information about the Pkg-perl-cvs-commits mailing list