r59798 - in /trunk/libtest-script-run-perl: Changes MANIFEST META.yml debian/changelog lib/Test/Script/Run.pm t/01.run.t t/script/

christine at users.alioth.debian.org christine at users.alioth.debian.org
Sat Jun 26 03:12:16 UTC 2010


Author: christine
Date: Sat Jun 26 03:11:29 2010
New Revision: 59798

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59798
Log:
new upstream version

Added:
    trunk/libtest-script-run-perl/t/script/
      - copied from r59797, branches/upstream/libtest-script-run-perl/current/t/script/
Modified:
    trunk/libtest-script-run-perl/Changes
    trunk/libtest-script-run-perl/MANIFEST
    trunk/libtest-script-run-perl/META.yml
    trunk/libtest-script-run-perl/debian/changelog
    trunk/libtest-script-run-perl/lib/Test/Script/Run.pm
    trunk/libtest-script-run-perl/t/01.run.t

Modified: trunk/libtest-script-run-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/Changes?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/Changes (original)
+++ trunk/libtest-script-run-perl/Changes Sat Jun 26 03:11:29 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: trunk/libtest-script-run-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/MANIFEST?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/MANIFEST (original)
+++ trunk/libtest-script-run-perl/MANIFEST Sat Jun 26 03:11:29 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: trunk/libtest-script-run-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/META.yml?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/META.yml (original)
+++ trunk/libtest-script-run-perl/META.yml Sat Jun 26 03:11:29 2010
@@ -20,4 +20,4 @@
   Test::Exception: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.03
+version: 0.04

Modified: trunk/libtest-script-run-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/debian/changelog?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/debian/changelog (original)
+++ trunk/libtest-script-run-perl/debian/changelog Sat Jun 26 03:11:29 2010
@@ -1,3 +1,9 @@
+libtest-script-run-perl (0.04-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Christine Spang <christine at debian.org>  Fri, 25 Jun 2010 23:09:11 -0400
+
 libtest-script-run-perl (0.03-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libtest-script-run-perl/lib/Test/Script/Run.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/lib/Test/Script/Run.pm?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/lib/Test/Script/Run.pm (original)
+++ trunk/libtest-script-run-perl/lib/Test/Script/Run.pm Sat Jun 26 03:11:29 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: trunk/libtest-script-run-perl/t/01.run.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/t/01.run.t?rev=59798&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/t/01.run.t (original)
+++ trunk/libtest-script-run-perl/t/01.run.t Sat Jun 26 03:11:29 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'
+);




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