r35208 - in /branches/upstream/libtest-command-perl/current: Changes META.yml lib/Test/Command.pm t/02-exit.t t/05-object.t t/06-signal.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Mon May 11 18:15:56 UTC 2009


Author: ansgar-guest
Date: Mon May 11 18:15:51 2009
New Revision: 35208

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

Modified:
    branches/upstream/libtest-command-perl/current/Changes
    branches/upstream/libtest-command-perl/current/META.yml
    branches/upstream/libtest-command-perl/current/lib/Test/Command.pm
    branches/upstream/libtest-command-perl/current/t/02-exit.t
    branches/upstream/libtest-command-perl/current/t/05-object.t
    branches/upstream/libtest-command-perl/current/t/06-signal.t

Modified: branches/upstream/libtest-command-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/Changes?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/Changes (original)
+++ branches/upstream/libtest-command-perl/current/Changes Mon May 11 18:15:51 2009
@@ -1,6 +1,11 @@
 Revision history for Test-Command
 
-0.03    Sat May 9 32:21:12 2009
+0.04    Sun May 10 09:38:05 2009
+        - exit and signal values can be undef if POSIX::WIFEXITED() or POSIX::WIFSIGNALED
+          return false respectively
+        - added exit_is_defined(), exit_is_undef(), signal_is_defined() and signal_is_undef()   
+
+0.03    Sat May 9 23:21:12 2009
         - use POSIX::WEXITSTATUS() to find exit status instead of manual bit shift
         - added terminating signal handling via POSIX::WTERMSIG() (was mentioned in
           "DEVELOPMENT IDEAS" but finally spurred on by Lanny Ripple via

Modified: branches/upstream/libtest-command-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/META.yml?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/META.yml (original)
+++ branches/upstream/libtest-command-perl/current/META.yml Mon May 11 18:15:51 2009
@@ -1,6 +1,6 @@
 ---
 name: Test-Command
-version: 0.03
+version: 0.04
 author:
   - 'Daniel B. Boorstein <danboo at cpan.org>'
 abstract: Test routines for external commands
@@ -12,7 +12,7 @@
 provides:
   Test::Command:
     file: lib/Test/Command.pm
-    version: 0.03
+    version: 0.04
 generated_by: Module::Build version 0.280802
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.2.html

Modified: branches/upstream/libtest-command-perl/current/lib/Test/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/lib/Test/Command.pm?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/lib/Test/Command.pm (original)
+++ branches/upstream/libtest-command-perl/current/lib/Test/Command.pm Mon May 11 18:15:51 2009
@@ -13,10 +13,14 @@
                   exit_is_num
                   exit_isnt_num
                   exit_cmp_ok
+                  exit_is_defined
+                  exit_is_undef
 
                   signal_is_num
                   signal_isnt_num
                   signal_cmp_ok
+                  signal_is_defined
+                  signal_is_undef
 
                   stdout_is_eq
                   stdout_isnt_eq
@@ -44,11 +48,11 @@
 
 =head1 VERSION
 
-Version 0.03
-
-=cut
-
-our $VERSION = '0.03';
+Version 0.04
+
+=cut
+
+our $VERSION = '0.04';
 
 =head1 SYNOPSIS
 
@@ -393,8 +397,8 @@
 
    ## run the command
    my $system_return = system(@{ $cmd });
-   my $exit_status   = WEXITSTATUS($system_return);
-   my $term_signal   = WTERMSIG($system_return);
+   my $exit_status   = WIFEXITED($system_return)   ? WEXITSTATUS($system_return) : undef;
+   my $term_signal   = WIFSIGNALED($system_return) ? WTERMSIG($system_return)    : undef;
 
    ## close and restore STDOUT and STDERR to original handles
    close STDOUT or confess "failed to close STDOUT: $!";
@@ -475,6 +479,48 @@
    return __PACKAGE__->builder->cmp_ok($result->{'exit_status'}, $op, $exp, $name);
    }
 
+=head3 exit_is_defined
+
+   exit_is_defined($cmd, $name)
+
+If the exit status of the command is defined, this passes. Otherwise it
+fails. A defined exit status indicates that the command exited normally
+by calling exit() or running off the end of the program.
+
+=cut
+
+sub exit_is_defined
+   {
+   my ($cmd, $op, $exp, $name) = @_;
+
+   my $result = _get_result($cmd);
+
+   $name = _build_name($name, @_);
+
+   return __PACKAGE__->builder->ok(defined $result->{'exit_status'}, $name);
+   }
+
+=head3 exit_is_undef
+
+   exit_is_undef($cmd, $name)
+
+If the exit status of the command is not defined, this passes. Otherwise it
+fails. An undefined exit status indicates that the command likely exited
+due to a signal.
+
+=cut
+
+sub exit_is_undef
+   {
+   my ($cmd, $op, $exp, $name) = @_;
+
+   my $result = _get_result($cmd);
+
+   $name = _build_name($name, @_);
+
+   return __PACKAGE__->builder->ok(! defined $result->{'exit_status'}, $name);
+   }
+
 =head2 Testing Terminating Signal
 
 The test routines below compare against the lower 8 bits of the exit status
@@ -539,6 +585,48 @@
    $name = _build_name($name, @_);
 
    return __PACKAGE__->builder->cmp_ok($result->{'term_signal'}, $op, $exp, $name);
+   }
+
+=head3 signal_is_defined
+
+   signal_is_defined($cmd, $name)
+
+If the terminating signal of the command is defined, this passes. Otherwise it
+fails. A defined signal indicates that the command likely exited due to a
+signal.
+
+=cut
+
+sub signal_is_defined
+   {
+   my ($cmd, $op, $exp, $name) = @_;
+
+   my $result = _get_result($cmd);
+
+   $name = _build_name($name, @_);
+
+   return __PACKAGE__->builder->ok(defined $result->{'term_signal'}, $name);
+   }
+
+=head3 signal_is_undef
+
+   signal_is_undef($cmd, $name)
+
+If the terminating signal of the command is not defined, this passes.
+Otherwise it fails. An undefined signal indicates that the command exited
+normally by calling exit() or running off the end of the program.
+
+=cut
+
+sub signal_is_undef
+   {
+   my ($cmd, $op, $exp, $name) = @_;
+
+   my $result = _get_result($cmd);
+
+   $name = _build_name($name, @_);
+
+   return __PACKAGE__->builder->ok(! defined $result->{'term_signal'}, $name);
    }
 
 =head2 Testing STDOUT

Modified: branches/upstream/libtest-command-perl/current/t/02-exit.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/t/02-exit.t?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/t/02-exit.t (original)
+++ branches/upstream/libtest-command-perl/current/t/02-exit.t Mon May 11 18:15:51 2009
@@ -1,6 +1,6 @@
 #!perl
 
-use Test::Command tests => 5;
+use Test::Command tests => 6;
 
 use Test::More;
 
@@ -10,7 +10,8 @@
 
 exit_is_num(qq($^X -e "exit 1"), 1);
 exit_is_num(qq($^X -e "exit 255"), 255);
-exit_is_num(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"), 0 );
+exit_is_defined(qq($^X -e "exit 255"));
+exit_is_undef(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"));
 
 exit_isnt_num(qq($^X -e 1), 2);
 

Modified: branches/upstream/libtest-command-perl/current/t/05-object.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/t/05-object.t?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/t/05-object.t (original)
+++ branches/upstream/libtest-command-perl/current/t/05-object.t Mon May 11 18:15:51 2009
@@ -1,6 +1,6 @@
 #!perl
 
-use Test::More tests => 29;
+use Test::More tests => 27;
 
 use Test::Command;
 
@@ -22,9 +22,7 @@
 $test_perl->exit_isnt_num(1);
 $test_perl->exit_cmp_ok('<', 1);
 
-$test_perl->signal_is_num(0);
-$test_perl->signal_isnt_num(1);
-$test_perl->signal_cmp_ok('<', 1);
+$test_perl->signal_is_undef;
 
 $test_perl->stdout_is_eq("foo\nbar\n");
 $test_perl->stdout_isnt_eq("bar\nfoo\n");

Modified: branches/upstream/libtest-command-perl/current/t/06-signal.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-command-perl/current/t/06-signal.t?rev=35208&op=diff
==============================================================================
--- branches/upstream/libtest-command-perl/current/t/06-signal.t (original)
+++ branches/upstream/libtest-command-perl/current/t/06-signal.t Mon May 11 18:15:51 2009
@@ -1,6 +1,6 @@
 #!perl
 
-use Test::Command tests => 6;
+use Test::Command tests => 7;
 
 use Test::More;
 
@@ -10,11 +10,12 @@
 
 system qq($^X -e 1) and BAIL_OUT('error calling perl via system');
 
-signal_is_num(qq($^X -e "exit 0"), 0);
-signal_is_num(qq($^X -e "exit 1"), 0);
-signal_is_num(qq($^X -e "exit 255"), 0);
+signal_is_undef(qq($^X -e "exit 0"));
+signal_is_undef(qq($^X -e "exit 1"));
+signal_is_undef(qq($^X -e "exit 255"));
 signal_is_num(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"), &POSIX::SIGTERM );
+signal_is_defined(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"));
 
-signal_isnt_num(qq($^X -e 1), 1);
+signal_is_undef(qq($^X -e 1));
 
-signal_cmp_ok(qq($^X -e "exit 1"), '<', 2);
+signal_cmp_ok(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"), '==', &POSIX::SIGTERM );




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