r47370 - in /trunk/libtest-script-run-perl: Changes META.yml debian/changelog debian/control debian/copyright lib/Test/Script/Run.pm

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Nov 17 15:18:34 UTC 2009


Author: jawnsy-guest
Date: Tue Nov 17 15:18:28 2009
New Revision: 47370

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47370
Log:
* New upstream release
* Add myself to Uploaders and Copyright
* Reformat control description

Modified:
    trunk/libtest-script-run-perl/Changes
    trunk/libtest-script-run-perl/META.yml
    trunk/libtest-script-run-perl/debian/changelog
    trunk/libtest-script-run-perl/debian/control
    trunk/libtest-script-run-perl/debian/copyright
    trunk/libtest-script-run-perl/lib/Test/Script/Run.pm

Modified: trunk/libtest-script-run-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/Changes?rev=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/Changes (original)
+++ trunk/libtest-script-run-perl/Changes Tue Nov 17 15:18:28 2009
@@ -1,4 +1,8 @@
 Revision history for Test-Script-Run
+
+0.03
+    Make get_perl_cmd public API
+    Strip references from @INC when generating a perl command
 
 0.02 Tue Jun  2 18:26:50 CST 2009
     add last_script_stdout, last_script_stderr and last_script_exit_code subs

Modified: trunk/libtest-script-run-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/META.yml?rev=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/META.yml (original)
+++ trunk/libtest-script-run-perl/META.yml Tue Nov 17 15:18:28 2009
@@ -20,4 +20,4 @@
   Test::Exception: 0
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.02
+version: 0.03

Modified: trunk/libtest-script-run-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/debian/changelog?rev=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/debian/changelog (original)
+++ trunk/libtest-script-run-perl/debian/changelog Tue Nov 17 15:18:28 2009
@@ -1,3 +1,11 @@
+libtest-script-run-perl (0.03-1) UNRELEASED; urgency=low
+
+  * New upstream release
+  * Add myself to Uploaders and Copyright
+  * Reformat control description
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Tue, 17 Nov 2009 06:52:19 -0500
+
 libtest-script-run-perl (0.02-1) unstable; urgency=low
 
   * Initial Release. (Closes: #541364)

Modified: trunk/libtest-script-run-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/debian/control?rev=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/debian/control (original)
+++ trunk/libtest-script-run-perl/debian/control Tue Nov 17 15:18:28 2009
@@ -4,8 +4,9 @@
 Build-Depends: debhelper (>= 7)
 Build-Depends-Indep: perl, libtest-exception-perl, libipc-run3-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Christine Spang <christine at debian.org>
-Standards-Version: 3.8.2
+Uploaders: Christine Spang <christine at debian.org>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Test-Script-Run/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtest-script-run-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libtest-script-run-perl
@@ -13,12 +14,12 @@
 Package: libtest-script-run-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, libtest-exception-perl,
-  libipc-run3-perl
+ libipc-run3-perl
 Description: Perl module for testing scripts as subprocesses
- Test::Script::Run provides Test::More-compatible subroutines for
- testing scripts in a Perl module distribution's bin/ directory
- using IPC::Run3 to spawn the scripts as subprocesses.
+ Test::Script::Run provides Test::More-compatible subroutines for testing
+ scripts in a Perl module distribution's bin/ directory using IPC::Run3 to
+ spawn the scripts as subprocesses.
  .
- Subroutines are provided for running scripts and simply checking that
- the return value is good, as well as capturing a script's STDOUT and
- STDERR and comparing against expected output.
+ Subroutines are provided for running scripts and simply checking that the
+ return value is good, as well as capturing a script's STDOUT and STDERR and
+ comparing against expected output.

Modified: trunk/libtest-script-run-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-script-run-perl/debian/copyright?rev=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/debian/copyright (original)
+++ trunk/libtest-script-run-perl/debian/copyright Tue Nov 17 15:18:28 2009
@@ -18,6 +18,7 @@
 
 Files: debian/*
 Copyright: 2009, Christine Spang <christine at debian.org>
+ 2009, Jonathan Yu <jawnsy at cpan.org>
 License: Artistic | GPL-1+
 
 License: Artistic

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=47370&op=diff
==============================================================================
--- trunk/libtest-script-run-perl/lib/Test/Script/Run.pm (original)
+++ trunk/libtest-script-run-perl/lib/Test/Script/Run.pm Tue Nov 17 15:18:28 2009
@@ -8,17 +8,50 @@
 use File::Basename;
 use File::Spec;
 
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 use base 'Exporter';
 our @EXPORT =
   qw/run_ok run_not_ok run_script run_output_matches run_output_matches_unordered/;
 our @EXPORT_OK = qw/is_script_output last_script_stdout last_script_stderr
-  last_script_exit_code/;
+  last_script_exit_code get_perl_cmd/;
 our %EXPORT_TAGS = ( all => [ @EXPORT, @EXPORT_OK ] );
 my (
     $last_script_stdout,        $last_script_stderr,
     $last_script_exit_code,
 );
+
+=head1 NAME
+
+Test::Script::Run - test the script with run
+
+=head1 SYNOPSIS
+
+    use Test::Script::Run;
+    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(
+        'app_name', [app's args],
+        [ 'out line 1', 'out line 2' ],
+        [ 'err line 1', 'err line 2' ],
+        'run_output_matches'
+    );
+    run_output_matches_unordered(
+        'app_name', [ app's args ],
+        [ 'out line 2', 'out line 1' ],
+        [ 'err line 2', 'err line 1' ],
+        'run_output_matches_unordered'
+    );
+
+=head1 DESCRIPTION
+
+This module exports some subs to help test and run scripts in your dist's 
+bin/ directory, if the script path is not absolute.
+
+Nearly all the essential code is stolen from Prophet::Test, we think subs like
+those should live below C<Test::> namespace, that's why we packed them and
+created this module.
+
+=head1 FUNCTIONS
 
 =head2 run_script($script, $args, $stdout, $stderr)
 
@@ -46,7 +79,7 @@
         ( $stdout, $stderr, $return_stdouterr ) =
           ( \$new_stdout, \$new_stderr, 1 );
     }
-    my @cmd = _get_perl_cmd($script);
+    my @cmd = get_perl_cmd($script);
 
     my $ret = run3 [ @cmd, @$args ], undef, $stdout, $stderr;
     $last_script_exit_code = $? >> 8;
@@ -120,31 +153,49 @@
 
 our $RUNCNT;
 
-# _get_perl_cmd( $script )
-# find the $script path
-
-sub _get_perl_cmd {
+
+=head2 get_perl_cmd($script, @ARGS)
+
+Returns a list suitable for passing to C<system>, C<exec>, etc. If you pass
+C<$script> then we will search upwards for a file F<bin/$script>.
+
+=cut
+
+sub get_perl_cmd {
     my $script = shift;
     my $base_dir;
-    unless ( File::Spec->file_name_is_absolute($script) ) {
-        my ( $tmp, $i ) = ( _updir($0), 0 );
-        while ( !-d File::Spec->catdir( $tmp, 'bin' ) && $i++ < 10 ) {
-            $tmp = _updir($tmp);
+
+    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 ) {
+                $tmp = _updir($tmp);
+            }
+
+            $base_dir = File::Spec->catdir( $tmp, 'bin' );
+            die "couldn't find bin dir" unless -d $base_dir;
         }
-
-        $base_dir = File::Spec->catdir( $tmp, 'bin' );
-        die "couldn't find bin dir" unless -d $base_dir;
-    }
-
-    my @cmd = ( $^X, ( map { "-I$_" } @INC ) );
+    }
+
+    # We grep out references because of INC-hooks like Jifty::ClassLoader
+    my @cmd = ( $^X, ( map { "-I$_" } grep {!ref($_)} @INC ) );
+
     push @cmd, '-MDevel::Cover' if $INC{'Devel/Cover.pm'};
     if ( $INC{'Devel/DProf.pm'} ) {
         push @cmd, '-d:DProf';
         $ENV{'PERL_DPROF_OUT_FILE_NAME'} = 'tmon.out.' . $$ . '.' . $RUNCNT++;
     }
-    push @cmd, $base_dir ? File::Spec->catdir( $base_dir => $script ) : $script;
+
+    if (defined $script) {
+        push @cmd, $base_dir ? File::Spec->catdir( $base_dir => $script ) : $script;
+        push @cmd, @_;
+    }
+
     return @cmd;
 }
+
+# back-compat
+*_get_perl_cmd = \&get_perl_cmd;
 
 =head2 is_script_output($scriptname \@args, \@stdout_match, \@stderr_match, $msg)
 
@@ -264,7 +315,7 @@
     my ( $script, $args, $expected, $stderr, $msg ) = @_;
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     lives_and {
-        local $Test::Builder::Level = $Test::Builder::Level + 3;
+        local $Test::Builder::Level = $Test::Builder::Level + 5;
         is_script_output( $script, $args, $expected, $stderr, $msg );
     };
 }
@@ -376,37 +427,6 @@
 
 __END__
 
-=head1 NAME
-
-Test::Script::Run - test the script with run
-
-=head1 SYNOPSIS
-
-    use Test::Script::Run;
-    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(
-        'app_name', [app's args],
-        [ 'out line 1', 'out line 2' ],
-        [ 'err line 1', 'err line 2' ],
-        'run_output_matches'
-    );
-    run_output_matches_unordered(
-        'app_name', [ app's args ],
-        [ 'out line 2', 'out line 1' ],
-        [ 'err line 2', 'err line 1' ],
-        'run_output_matches_unordered'
-    );
-
-=head1 DESCRIPTION
-
-This module exports some subs to help test and run scripts in your dist's 
-bin/ directory, if the script path is not absolute.
-
-Nearly all the essential code is stolen from Prophet::Test, we think subs like
-those should live below C<Test::> namespace, that's why we packed them and
-created this module.
-
 =head1 DEPENDENCIES
 
 L<Test::More>, L<Test::Exception>, L<IPC::Run3>, L<File::Basename>, L<File::Spec>
@@ -426,3 +446,5 @@
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.
 
+=cut
+




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