summaryrefslogtreecommitdiff
path: root/t/comp/filter_exception.t
blob: ea0e9d7c2c47bbf455d373a8adc5d66de7b07af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!./perl 

BEGIN {
    chdir 't' if -d 't';
    require './test.pl';
}

plan tests => 4;

BEGIN {
    unshift @INC, sub {
	return () unless $_[1] =~ m#\At/(Foo|Bar)\.pm\z#;
	my $t = 0;
	return sub {
	    if(!$t) {
		$_ = "int(1,2);\n";
		$t = 1;
		$@ = "wibble";
		return 1;
	    } else {
		return 0;
	    }
	};
    };
}

is +(do "t/Bar.pm"), undef;
like $@, qr/\AToo many arguments for int /;
is eval { require "t/Foo.pm" }, undef;
like $@, qr/\AToo many arguments for int /;

1;