r35210 - in /trunk/libtest-command-perl: Changes META.yml debian/changelog 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:32:25 UTC 2009
Author: ansgar-guest
Date: Mon May 11 18:32:20 2009
New Revision: 35210
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35210
Log:
Update to 0.04
Modified:
trunk/libtest-command-perl/Changes
trunk/libtest-command-perl/META.yml
trunk/libtest-command-perl/debian/changelog
trunk/libtest-command-perl/lib/Test/Command.pm
trunk/libtest-command-perl/t/02-exit.t
trunk/libtest-command-perl/t/05-object.t
trunk/libtest-command-perl/t/06-signal.t
Modified: trunk/libtest-command-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/Changes?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/Changes (original)
+++ trunk/libtest-command-perl/Changes Mon May 11 18:32:20 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: trunk/libtest-command-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/META.yml?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/META.yml (original)
+++ trunk/libtest-command-perl/META.yml Mon May 11 18:32:20 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: trunk/libtest-command-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/debian/changelog?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/debian/changelog (original)
+++ trunk/libtest-command-perl/debian/changelog Mon May 11 18:32:20 2009
@@ -1,4 +1,4 @@
-libtest-command-perl (0.03-1) unstable; urgency=low
+libtest-command-perl (0.04-1) unstable; urgency=low
[ gregor herrmann ]
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
@@ -12,7 +12,7 @@
* Add perl-modules (>= 5.10) as an alternative build-dep to
libmodule-build-perl.
- -- Ansgar Burchardt <ansgar at 43-1.org> Sun, 10 May 2009 18:10:46 +0200
+ -- Ansgar Burchardt <ansgar at 43-1.org> Mon, 11 May 2009 20:19:16 +0200
libtest-command-perl (0.02-1) unstable; urgency=low
Modified: trunk/libtest-command-perl/lib/Test/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/lib/Test/Command.pm?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/lib/Test/Command.pm (original)
+++ trunk/libtest-command-perl/lib/Test/Command.pm Mon May 11 18:32:20 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: trunk/libtest-command-perl/t/02-exit.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/02-exit.t?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/02-exit.t (original)
+++ trunk/libtest-command-perl/t/02-exit.t Mon May 11 18:32:20 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: trunk/libtest-command-perl/t/05-object.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/05-object.t?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/05-object.t (original)
+++ trunk/libtest-command-perl/t/05-object.t Mon May 11 18:32:20 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: trunk/libtest-command-perl/t/06-signal.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/06-signal.t?rev=35210&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/06-signal.t (original)
+++ trunk/libtest-command-perl/t/06-signal.t Mon May 11 18:32:20 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