]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Add a regression test for a bug that appeared while fixing RT #50570 but got re-fixed...
authorVincent Pit <vince@profvince.com>
Sun, 18 Apr 2010 16:07:40 +0000 (18:07 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 18 Apr 2010 16:08:23 +0000 (18:08 +0200)
MANIFEST
t/30-scope.t
t/lib/indirect/TestRequired5/a0.pm [new file with mode: 0644]
t/lib/indirect/TestRequired5/b0.pm [new file with mode: 0644]
t/lib/indirect/TestRequired5/c0.pm [new file with mode: 0644]
t/lib/indirect/TestRequired5/d0.pm [new file with mode: 0644]

index 5ccc28895c7959735ac7a691c0f5196b6635cfa0..9cc5beb0fefae050377cd265aa40509f86282189 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -36,3 +36,7 @@ t/lib/indirect/TestRequired3Y.pm
 t/lib/indirect/TestRequired4/a0.pm
 t/lib/indirect/TestRequired4/b0.pm
 t/lib/indirect/TestRequired4/c0.pm
+t/lib/indirect/TestRequired5/a0.pm
+t/lib/indirect/TestRequired5/b0.pm
+t/lib/indirect/TestRequired5/c0.pm
+t/lib/indirect/TestRequired5/d0.pm
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;
 
diff --git a/t/lib/indirect/TestRequired5/a0.pm b/t/lib/indirect/TestRequired5/a0.pm
new file mode 100644 (file)
index 0000000..159d4d6
--- /dev/null
@@ -0,0 +1,9 @@
+package indirect::TestRequired5::a0;
+no indirect ":fatal";
+use indirect::TestRequired5::b0;
+sub error {
+ local $@;
+ indirect::TestRequired5::b0->get;
+ return $@;
+}
+1;
diff --git a/t/lib/indirect/TestRequired5/b0.pm b/t/lib/indirect/TestRequired5/b0.pm
new file mode 100644 (file)
index 0000000..b71bde8
--- /dev/null
@@ -0,0 +1,5 @@
+package indirect::TestRequired5::b0;
+sub get {
+ eval 'require indirect::TestRequired5::c0';
+}
+1;
diff --git a/t/lib/indirect/TestRequired5/c0.pm b/t/lib/indirect/TestRequired5/c0.pm
new file mode 100644 (file)
index 0000000..3668c79
--- /dev/null
@@ -0,0 +1,3 @@
+package indirect::TestRequired5::c0;
+require indirect::TestRequired5::d0;
+1;
diff --git a/t/lib/indirect/TestRequired5/d0.pm b/t/lib/indirect/TestRequired5/d0.pm
new file mode 100644 (file)
index 0000000..a9b21a8
--- /dev/null
@@ -0,0 +1,3 @@
+package indirect::TestRequired5::d0;
+new X;
+1;