4 use Test::More 'no_plan';
6 use constant NO_SUCH_FILE => 'this_file_had_better_not_exist';
7 use constant EXCEPTION => 'autodie::exception';
9 # http://perlmonks.org/?node_id=744246 describes a situation where
10 # using autodie on user-defined functions can fail, depending upon
11 # their context. These tests attempt to detect this bug.
15 copy(NO_SUCH_FILE, 'xyzzy');
18 isa_ok($@,EXCEPTION,"Copying a non-existent file should throw an error");
22 my $x = copy(NO_SUCH_FILE, 'xyzzy');
25 isa_ok($@,EXCEPTION,"This shouldn't change with scalar context");
29 my @x = copy(NO_SUCH_FILE, 'xyzzy');
33 local $TODO = "Fixed in 'hints' branch";
35 isa_ok($@,EXCEPTION,"This shouldn't change with array context");
38 # For good measure, test with built-ins.
42 open(my $fh, '<', 'xyzzy');
45 isa_ok($@,EXCEPTION,"Opening a non-existent file should throw an error");
49 my $x = open(my $fh, '<', 'xyzzy');
52 isa_ok($@,EXCEPTION,"This shouldn't change with scalar context");
56 my @x = open(my $fh, '<', 'xyzzy');
59 isa_ok($@,EXCEPTION,"This shouldn't change with array context");