This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Carp: add a test for top-of-stack longmess
[perl5.git] / dist / Carp / t / Carp.t
index 06e9770..f7c226a 100644 (file)
@@ -3,7 +3,7 @@ no warnings "once";
 use Config;
 
 use IPC::Open3 1.0103 qw(open3);
-use Test::More tests => 60;
+use Test::More tests => 61;
 
 sub runperl {
     my(%args) = @_;
@@ -28,6 +28,15 @@ BEGIN {
 }
 
 {
+  my $str = Carp::longmess("foo");
+  is(
+    $str,
+    "foo at t/Carp.t line 31.\n",
+    "we don't overshoot the top stack frame",
+  );
+}
+
+{
     local $SIG{__WARN__} = sub {
         like $_[0], qr/ok (\d+)\n at.+\b(?i:carp\.t) line \d+\.$/, 'ok 2\n';
     };