This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Locale-Maketext-1.10. As change #25547 did not make it
[perl5.git] / lib / Fatal.t
1 #!./perl -w
2
3 BEGIN {
4    chdir 't' if -d 't';
5    @INC = '../lib';
6    print "1..15\n";
7 }
8
9 use strict;
10 use Fatal qw(open close :void opendir);
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
23     print "not " if $@ or scalar(<$foo>) !~ m|^#!./perl|;
24     print "ok $i\n"; ++$i;
25     eval qq{ close FOO };
26     print "not " if $@;
27     print "ok $i\n"; ++$i;
28 }
29
30 eval { opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' };
31 print "not " unless $@ =~ /^Can't open/;
32 print "ok $i\n"; ++$i;
33
34 eval { my $a = opendir FOO, 'lkjqweriuapofukndajsdlfjnvcvn' };
35 print "not " if $@ =~ /^Can't open/;
36 print "ok $i\n"; ++$i;