develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #115046] [PATCH 1/2] Test for errors requiring .ph files.

Thread Previous
From:
Paul Johnson
Date:
September 25, 2012 17:45
Subject:
[perl #115046] [PATCH 1/2] Test for errors requiring .ph files.
Message ID:
rt-3.6.HEAD-11172-1348620323-1881.115046-75-0@perl.org
# New Ticket Created by  "Paul Johnson" 
# Please include the string:  [perl #115046]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115046 >


---
 t/op/require_errors.t |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/t/op/require_errors.t b/t/op/require_errors.t
index f617e6a..1f243a6 100644
--- a/t/op/require_errors.t
+++ b/t/op/require_errors.t
@@ -7,7 +7,7 @@ BEGIN {
     require './test.pl';
 }
 
-plan(tests => 9);
+plan(tests => 11);
 
 my $nonfile = tempfile();
 
@@ -45,6 +45,15 @@ for my $file ("$nonfile.h", ".h") {
 	"correct error message for require '$file'";
 }
 
+for my $file ("$nonfile.ph", ".ph") {
+    eval {
+	require $file
+    };
+
+    like $@, qr/^Can't locate \Q$file\E in \@INC \(did you run h2ph\?\) \(\@INC contains: @INC\) at/,
+	"correct error message for require '$file'";
+}
+
 eval 'require <foom>';
 like $@, qr/^<> should be quotes at /, 'require <> error';
 
-- 
1.7.9.5


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About