@@ -27,7 +27,7 @@ for my $file ($nonfile, ' ') {
2727 require $file ;
2828 };
2929
30- like $@ , qr / ^Can't locate $file in \@ INC \(\@ INC contains : \Q @INC \E\) at/ ,
30+ like $@ , qr / ^Can't locate $file in \@ INC \(\@ INC[ \w ]+ : \Q @INC \E\) at/ ,
3131 " correct error message for require '$file '" ;
3232}
3333
@@ -91,7 +91,7 @@ for my $file ($nonfile, ' ') {
9191 $hint =~ s /\. pm$// ;
9292 $exp .= " (you may need to install the $hint module)" ;
9393 }
94- $exp .= " (\@ INC contains : @INC ) at" ;
94+ $exp .= " (\@ INC entries checked : @INC ) at" ;
9595 }
9696 else {
9797 # undef implies a require which doesn't compile,
@@ -139,14 +139,14 @@ eval {
139139 require " $nonfile .ph" ;
140140};
141141
142- like $@ , qr / ^Can't locate $nonfile \. ph in \@ INC \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ;
142+ like $@ , qr / ^Can't locate $nonfile \. ph in \@ INC \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ;
143143
144144for my $file (" $nonfile .h" , " .h" ) {
145145 eval {
146146 require $file
147147 };
148148
149- like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( change \. h to \. ph maybe\?\) \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ,
149+ like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( change \. h to \. ph maybe\?\) \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ,
150150 " correct error message for require '$file '" ;
151151}
152152
@@ -155,7 +155,7 @@ for my $file ("$nonfile.ph", ".ph") {
155155 require $file
156156 };
157157
158- like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( did you run h2ph\?\) \(\@ INC contains : @INC \) at/ ,
158+ like $@ , qr / ^Can't locate \Q $file \E in \@ INC \( did you run h2ph\?\) \(\@ INC[ \w ]+ : @INC \) at/ ,
159159 " correct error message for require '$file '" ;
160160}
161161
@@ -311,24 +311,22 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
311311 { }, ' Inc hooks have the correct cop_file' );
312312}
313313{
314- local $: :TODO = " Pending segfault fix" ;
315314 # this can segfault or assert prior to @INC hardening.
316315 fresh_perl_like(
317316 ' unshift @INC, sub { *INC=["a","b"] }; '
318317 .' eval "require Frobnitz" or print $@' ,
319- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
318+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
320319 { }, ' INC hooks do not segfault when overwritten' );
321320}
322321{
323- local $: :TODO = " Pending error message improvement" ;
324322 # this is the defined behavior, but in older perls the error message
325323 # would lie and say "contains: a b", which is true in the sense that
326324 # it is the value of @INC after the require, but not the directory
327325 # list that was looked at.
328326 fresh_perl_like(
329327 ' @INC = (sub { @INC=("a","b"); () }, "z"); '
330328 .' eval "require Frobnitz" or print $@' ,
331- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
329+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) b\) ! ,
332330 { }, ' INC hooks that overwrite @INC continue as expected (skips a and z)' );
333331}
334332{
@@ -337,7 +335,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
337335 fresh_perl_like(
338336 ' @INC = (sub { @INC=qw(a b); undef $INC }, "z"); '
339337 .' eval "require Frobnitz" or print $@' ,
340- qr !\(\@ INC contains : CODE\( 0x[A-Fa-f0-9]+\) a b\) ! ,
338+ qr !\(\@ INC[ \w ]+ : CODE\( 0x[A-Fa-f0-9]+\) a b\) ! ,
341339 { }, ' INC hooks that overwrite @INC and undef $INC continue at start' );
342340}
343341{
@@ -347,7 +345,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
347345 ' sub CB::INCDIR { return "b", "c","d" }; '
348346 .' @INC = ("a",bless({},"CB"),"e");'
349347 .' eval "require Frobnitz" or print $@' ,
350- qr !\(\@ INC contains : a CB=HASH\( 0x[A-Fa-f0-9]+\) b c d e\) ! ,
348+ qr !\(\@ INC[ \w ]+ : a CB=HASH\( 0x[A-Fa-f0-9]+\) b c d e\) ! ,
351349 { }, ' INCDIR works as expected' );
352350}
353351{
@@ -356,7 +354,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
356354 fresh_perl_like(
357355 ' @INC = ("a",bless({},"CB"),"e");'
358356 .' eval "require Frobnitz" or print $@' ,
359- qr !\(\@ INC contains : a CB=HASH\( 0x[A-Fa-f0-9]+\) e\) ! ,
357+ qr !\(\@ INC[ \w ]+ : a CB=HASH\( 0x[A-Fa-f0-9]+\) e\) ! ,
360358 { }, ' Objects with no INC or INCDIR method are stringified' );
361359}
362360{
@@ -366,7 +364,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
366364 ' {package CB; use overload qw("")=>sub { "blorg"};} '
367365 .' @INC = ("a",bless({},"CB"),"e");'
368366 .' eval "require Frobnitz" or print $@' ,
369- qr !\(\@ INC contains : a blorg e\) ! ,
367+ qr !\(\@ INC[ \w ]+ : a blorg e\) ! ,
370368 { }, ' Objects with overload and no INC or INCDIR method are stringified' );
371369}
372370{
@@ -375,7 +373,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
375373 fresh_perl_like(
376374 ' @INC = ("a",bless(sub { warn "blessed sub called" },"CB"),"e");'
377375 .' eval "require Frobnitz" or print $@' ,
378- qr ! blessed sub called.*\(\@ INC contains : a CB=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
376+ qr ! blessed sub called.*\(\@ INC[ \w ]+ : a CB=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
379377 { }, ' Blessed subs with no hook methods are executed' );
380378}
381379{
@@ -412,7 +410,7 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
412410 ' sub CB::INCDIR { "i" } sub CB2::INCDIR { }'
413411 .' @INC = ("a",bless(sub{"b"},"CB"),bless(sub{"c"},"CB2"),"e");'
414412 .' eval "require Frobnitz" or print $@' ,
415- qr !\(\@ INC contains : a CB=CODE\( 0x[a-fA-F0-9]+\) i CB2=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
413+ qr !\(\@ INC[ \w ]+ : a CB=CODE\( 0x[a-fA-F0-9]+\) i CB2=CODE\( 0x[a-fA-F0-9]+\) e\) ! s ,
416414 { }, ' Blessed subs with INCDIR methods call INCDIR' );
417415}
418416{
@@ -422,6 +420,6 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
422420 ' sub CB::INCDIR { return @{$_[2]} }'
423421 .' @INC = ("a",[bless([],"CB"),"b"],"c");'
424422 .' eval "require Frobnitz" or print $@' ,
425- qr !\(\@ INC contains : a ARRAY\( 0x[a-fA-F0-9]+\) CB=ARRAY\( 0x[a-fA-F0-9]+\) b c\) ! s ,
423+ qr !\(\@ INC[ \w ]+ : a ARRAY\( 0x[a-fA-F0-9]+\) CB=ARRAY\( 0x[a-fA-F0-9]+\) b c\) ! s ,
426424 { }, ' INCDIR ref returns are stringified' );
427425}
0 commit comments