| 1 | #!./perl |
| 2 | |
| 3 | BEGIN { |
| 4 | chdir 't' if -d 't'; |
| 5 | require './test.pl'; |
| 6 | } |
| 7 | |
| 8 | plan tests => 4; |
| 9 | |
| 10 | BEGIN { |
| 11 | unshift @INC, sub { |
| 12 | return () unless $_[1] =~ m#\At/(Foo|Bar)\.pm\z#; |
| 13 | my $t = 0; |
| 14 | return sub { |
| 15 | if(!$t) { |
| 16 | $_ = "int(1,2);\n"; |
| 17 | $t = 1; |
| 18 | $@ = "wibble"; |
| 19 | return 1; |
| 20 | } else { |
| 21 | return 0; |
| 22 | } |
| 23 | }; |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | is +(do "t/Bar.pm"), undef; |
| 28 | like $@, qr/\AToo many arguments for int /; |
| 29 | is eval { require "t/Foo.pm" }, undef; |
| 30 | like $@, qr/\AToo many arguments for int /; |
| 31 | |
| 32 | 1; |