Add a regression test for RT #50570
authorVincent Pit <vince@profvince.com>
Sun, 18 Apr 2010 15:53:20 +0000 (17:53 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 18 Apr 2010 15:53:20 +0000 (17:53 +0200)
MANIFEST
t/30-scope.t
t/lib/indirect/TestRequired4/a0.pm [new file with mode: 0644]
t/lib/indirect/TestRequired4/b0.pm [new file with mode: 0644]
t/lib/indirect/TestRequired4/c0.pm [new file with mode: 0644]

index af5db83..5ccc288 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -33,3 +33,6 @@ t/lib/indirect/TestRequired1.pm
 t/lib/indirect/TestRequired2.pm
 t/lib/indirect/TestRequired3X.pm
 t/lib/indirect/TestRequired3Y.pm
+t/lib/indirect/TestRequired4/a0.pm
+t/lib/indirect/TestRequired4/b0.pm
+t/lib/indirect/TestRequired4/c0.pm
index ad4abc8..7f31ebb 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 + 1;
+use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 2;
 
 BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
 
@@ -153,6 +153,14 @@ sub expect {
  is $@, '', 'RT #47902';
 }
 
+{
+ my $err = eval <<' SNIP';
+  use indirect::TestRequired4::a0;
+  indirect::TestRequired4::a0::error();
+ SNIP
+ like $err, qr/^Can't locate object method "new" via package "X"/, 'RT #50570';
+}
+
 __DATA__
 my $a = new P1;
 
diff --git a/t/lib/indirect/TestRequired4/a0.pm b/t/lib/indirect/TestRequired4/a0.pm
new file mode 100644 (file)
index 0000000..583f88f
--- /dev/null
@@ -0,0 +1,8 @@
+package indirect::TestRequired4::a0;
+no indirect ":fatal";
+use indirect::TestRequired4::b0;
+sub error {
+ indirect::TestRequired4::b0->get;
+ return $@;
+}
+1;
diff --git a/t/lib/indirect/TestRequired4/b0.pm b/t/lib/indirect/TestRequired4/b0.pm
new file mode 100644 (file)
index 0000000..0fe362d
--- /dev/null
@@ -0,0 +1,5 @@
+package indirect::TestRequired4::b0;
+sub get {
+ eval 'require indirect::TestRequired4::c0';
+}
+1;
diff --git a/t/lib/indirect/TestRequired4/c0.pm b/t/lib/indirect/TestRequired4/c0.pm
new file mode 100644 (file)
index 0000000..6c04262
--- /dev/null
@@ -0,0 +1,3 @@
+package indirect::TestRequired4::c0;
+new X;
+1;