This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta: entry for qr/\87/ bug fix
[perl5.git] / t / op / require_errors.t
CommitLineData
686c4ca0
NC
1#!perl
2use strict;
3use warnings;
4
5BEGIN {
c69577e2 6 chdir 't';
686c4ca0
NC
7 require './test.pl';
8}
9
32437794 10plan(tests => 4);
686c4ca0
NC
11
12my $nonfile = tempfile();
13
14@INC = qw(Perl Rules);
15
16eval {
17 require $nonfile;
18};
19
20like $@, qr/^Can't locate $nonfile in \@INC \(\@INC contains: @INC\) at/;
21
22eval {
23 require "$nonfile.ph";
24};
25
26like $@, qr/^Can't locate $nonfile\.ph in \@INC \(did you run h2ph\?\) \(\@INC contains: @INC\) at/;
27
28eval {
29 require "$nonfile.h";
30};
31
32like $@, qr/^Can't locate $nonfile\.h in \@INC \(change \.h to \.ph maybe\?\) \(did you run h2ph\?\) \(\@INC contains: @INC\) at/;
33
32437794
FC
34eval 'require <foom>';
35like $@, qr/^<> should be quotes at /, 'require <> error';
36
686c4ca0
NC
37# I can't see how to test the EMFILE case
38# I can't see how to test the case of not displaying @INC in the message.
39# (and does that only happen on VMS?)