]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - t/30-scope.t
Add a regression test for a bug that appeared while fixing RT #50570 but got re-fixed...
[perl/modules/indirect.git] / t / 30-scope.t
index 7f31ebb3f9b23bb33d56287149464505a357d529..a63bf04c012eadd15f1a1191f88fc86853ef2f0b 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 my $tests;
 BEGIN { $tests = 18 }
 
-use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 2;
+use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 3;
 
 BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
 
@@ -161,6 +161,12 @@ sub expect {
  like $err, qr/^Can't locate object method "new" via package "X"/, 'RT #50570';
 }
 
+# This test must be in the topmost scope
+BEGIN { eval 'use indirect::TestRequired5::a0' }
+my $err = indirect::TestRequired5::a0::error();
+like $err, qr/^Can't locate object method "new" via package "X"/,
+           'identifying requires by their eval context pointer is not enough';
+
 __DATA__
 my $a = new P1;