From: Jarkko Hietaniemi Date: Mon, 28 May 2001 14:24:08 +0000 (+0000) Subject: Add a test for carp et alia. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0e25c5fd6896160f4115f7b66a6914d9c01ef7df;p=p5sagit%2Fp5-mst-13.2.git Add a test for carp et alia. p4raw-id: //depot/perl@10246 --- diff --git a/MANIFEST b/MANIFEST index c61084b..226a312 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1467,6 +1467,7 @@ t/lib/bigfloat.t See if bigfloat.pl works t/lib/bigfltpm.t See if BigFloat.pm works t/lib/bigint.t See if bigint.pl works t/lib/bigintpm.t See if BigInt.pm works +t/lib/carp.t See if Carp works t/lib/cgi-esc.t See if CGI.pm works t/lib/cgi-form.t See if CGI.pm works t/lib/cgi-function.t See if CGI.pm works diff --git a/t/lib/carp.t b/t/lib/carp.t new file mode 100644 index 0000000..0e63382 --- /dev/null +++ b/t/lib/carp.t @@ -0,0 +1,45 @@ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use Carp qw(carp cluck croak confess); + +print "1..7\n"; + +print "ok 1\n"; + +carp "ok 2\n"; + +$SIG{__WARN__} = sub { print "ok $1\n" + if $_[0] =~ m!(\d+) at .+\b(?i:carp\.t) line \d+$! }; + +carp 3; + +sub sub_4 { + +$SIG{__WARN__} = sub { print "ok $1\n" + if $_[0] =~ m!^(\d+) at .+\b(?i:carp\.t) line \d+\n\tmain::sub_4\(\) called at .+\b(?i:carp\.t) line \d+$! }; + +cluck 4; + +} + +sub_4; + +$SIG{__DIE__} = sub { print "ok $1\n" + if $_[0] =~ m!^(\d+) at .+\b(?i:carp\.t) line \d+\n\teval \Q{...}\E called at .+\b(?i:carp\.t) line \d+$! }; + +eval { croak 5 }; + +sub sub_6 { + $SIG{__DIE__} = sub { print "ok $1\n" + if $_[0] =~ m!^(\d+) at .+\b(?i:carp\.t) line \d+\n\teval \Q{...}\E called at .+\b(?i:carp\.t) line \d+\n\tmain::sub_6\(\) called at .+\b(?i:carp\.t) line \d+$! }; + + eval { confess 6 }; +} + +sub_6; + +print "ok 7\n"; +