This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Exercise the utf8:: "internal" functions.
[perl5.git] / lib / Carp.t
index e9dd8cd..2ea98d8 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
 
 use Carp qw(carp cluck croak confess);
 
-print "1..8\n";
+print "1..9\n";
 
 print "ok 1\n";
 
@@ -56,3 +56,16 @@ my $eval = "use Carp::Heavy; return Carp::caller_info(0);";
 my %info = eval($eval);
 print "not " if ($info{sub_name} ne "eval '$eval'");
 print "ok 8\n";
+
+# test for '...::CARP_NOT used only once' warning from Carp::Heavy
+my $warning;
+eval {
+    BEGIN {
+       $^W = 1;
+       $SIG{__WARN__} =
+           sub { if( defined $^S ){ warn $_[0] } else { $warning = $_[0] } }
+    }
+    package Z; 
+    BEGIN { eval { Carp::croak() } }
+};
+print $warning ? "not ok 9\n#$warning" : "ok 9\n";