This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / lib / Carp.t
index 47f83c9..d07e202 100644 (file)
@@ -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 $!');