I don't think trying to bracket the hires time with lores
[p5sagit/p5-mst-13.2.git] / lib / Fatal.t
CommitLineData
2ba6ecf4 1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
20822f61 5 @INC = '../lib';
91c7a880 6 print "1..15\n";
2ba6ecf4 7}
8
9use strict;
91c7a880 10use Fatal qw(open close :void opendir);
2ba6ecf4 11
12my $i = 1;
13eval { open FOO, '<lkjqweriuapofukndajsdlfjnvcvn' };
14print "not " unless $@ =~ /^Can't open/;
15print "ok $i\n"; ++$i;
16
17my $foo = 'FOO';
18for ('$foo', "'$foo'", "*$foo", "\\*$foo") {
19 eval qq{ open $_, '<$0' };
20 print "not " if $@;
21 print "ok $i\n"; ++$i;
22
a9ef352a 23 print "not " if $@ or scalar(<$foo>) !~ m|^#!./perl|;
24 print "ok $i\n"; ++$i;
25 eval qq{ close FOO };
2ba6ecf4 26 print "not " if $@;
27 print "ok $i\n"; ++$i;
2ba6ecf4 28}
91c7a880 29
30eval { opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' };
31print "not " unless $@ =~ /^Can't open/;
32print "ok $i\n"; ++$i;
33
9c8a64f0 34eval { my $a = opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' };
91c7a880 35print "not " if $@ =~ /^Can't open/;
36print "ok $i\n"; ++$i;