Commit | Line | Data |
---|---|---|
2ba6ecf4 GS |
1 | #!./perl -w |
2 | ||
3 | BEGIN { | |
4 | chdir 't' if -d 't'; | |
20822f61 | 5 | @INC = '../lib'; |
df029878 | 6 | print "1..16\n"; |
2ba6ecf4 GS |
7 | } |
8 | ||
9 | use strict; | |
594e23a5 | 10 | use Fatal qw(open close :void opendir sin); |
2ba6ecf4 GS |
11 | |
12 | my $i = 1; | |
13 | eval { open FOO, '<lkjqweriuapofukndajsdlfjnvcvn' }; | |
14 | print "not " unless $@ =~ /^Can't open/; | |
15 | print "ok $i\n"; ++$i; | |
16 | ||
17 | my $foo = 'FOO'; | |
18 | for ('$foo', "'$foo'", "*$foo", "\\*$foo") { | |
19 | eval qq{ open $_, '<$0' }; | |
20 | print "not " if $@; | |
21 | print "ok $i\n"; ++$i; | |
22 | ||
a9ef352a GS |
23 | print "not " if $@ or scalar(<$foo>) !~ m|^#!./perl|; |
24 | print "ok $i\n"; ++$i; | |
25 | eval qq{ close FOO }; | |
2ba6ecf4 GS |
26 | print "not " if $@; |
27 | print "ok $i\n"; ++$i; | |
2ba6ecf4 | 28 | } |
91c7a880 GS |
29 | |
30 | eval { opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' }; | |
31 | print "not " unless $@ =~ /^Can't open/; | |
32 | print "ok $i\n"; ++$i; | |
33 | ||
9c8a64f0 | 34 | eval { my $a = opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' }; |
91c7a880 GS |
35 | print "not " if $@ =~ /^Can't open/; |
36 | print "ok $i\n"; ++$i; | |
df029878 SR |
37 | |
38 | eval { Fatal->import(qw(print)) }; | |
39 | if ($@ !~ m{Cannot make the non-overridable builtin print fatal}) { | |
40 | print "not "; | |
41 | } | |
42 | print "ok $i\n"; ++$i; |