xref: /openbsd-src/gnu/usr.bin/perl/t/op/require_errors.t (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1*898184e3Ssthen#!perl
2*898184e3Ssthenuse strict;
3*898184e3Ssthenuse warnings;
4*898184e3Ssthen
5*898184e3SsthenBEGIN {
6*898184e3Ssthen    require './test.pl';
7*898184e3Ssthen}
8*898184e3Ssthen
9*898184e3Ssthenplan(tests => 3);
10*898184e3Ssthen
11*898184e3Ssthenmy $nonfile = tempfile();
12*898184e3Ssthen
13*898184e3Ssthen@INC = qw(Perl Rules);
14*898184e3Ssthen
15*898184e3Sstheneval {
16*898184e3Ssthen    require $nonfile;
17*898184e3Ssthen};
18*898184e3Ssthen
19*898184e3Ssthenlike $@, qr/^Can't locate $nonfile in \@INC \(\@INC contains: @INC\) at/;
20*898184e3Ssthen
21*898184e3Sstheneval {
22*898184e3Ssthen    require "$nonfile.ph";
23*898184e3Ssthen};
24*898184e3Ssthen
25*898184e3Ssthenlike $@, qr/^Can't locate $nonfile\.ph in \@INC \(did you run h2ph\?\) \(\@INC contains: @INC\) at/;
26*898184e3Ssthen
27*898184e3Sstheneval {
28*898184e3Ssthen    require "$nonfile.h";
29*898184e3Ssthen};
30*898184e3Ssthen
31*898184e3Ssthenlike $@, qr/^Can't locate $nonfile\.h in \@INC \(change \.h to \.ph maybe\?\) \(did you run h2ph\?\) \(\@INC contains: @INC\) at/;
32*898184e3Ssthen
33*898184e3Ssthen# I can't see how to test the EMFILE case
34*898184e3Ssthen# I can't see how to test the case of not displaying @INC in the message.
35*898184e3Ssthen# (and does that only happen on VMS?)
36