diff options
author | Steve Hay <SteveHay@planit.com> | 2005-05-03 08:51:24 +0000 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2005-05-03 08:51:24 +0000 |
commit | 62e1ddac2ea58cd2a35011515be4801254772ba8 (patch) | |
tree | e3439b004419ecce35771e52cebf31e6eaf7affd /lib/Carp.t | |
parent | f350b448ae021c71a4662e0a5bb0b3454004be98 (diff) | |
download | perl-62e1ddac2ea58cd2a35011515be4801254772ba8.tar.gz |
Fix croak() and confess() so that they don't clobber $!
(plus tests to check this)
p4raw-id: //depot/perl@24374
Diffstat (limited to 'lib/Carp.t')
-rw-r--r-- | lib/Carp.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Carp.t b/lib/Carp.t index 47f83c96c1..d07e202d15 100644 --- a/lib/Carp.t +++ b/lib/Carp.t @@ -6,7 +6,7 @@ BEGIN { use Carp qw(carp cluck croak confess); -plan tests => 19; +plan tests => 21; ok 1; @@ -155,3 +155,9 @@ sub w { cluck @_ } main::w(1); } } + +# Check that croak() and confess() don't clobber $! +runperl(prog => 'use Carp; $@=q{Phooey}; $!=42; croak(q{Dead})', stderr => 1); +is($?>>8, 42, 'croak() doesn\'t clobber $!'); +runperl(prog => 'use Carp; $@=q{Phooey}; $!=42; confess(q{Dead})', stderr => 1); +is($?>>8, 42, 'confess() doesn\'t clobber $!'); |