4 use constant NO_SUCH_FILE => "this_file_or_dir_had_better_not_exist_XYZZY";
6 use Test::More tests => 6;
8 # Lexical tests using the internal interface.
10 eval { Fatal->import(qw(:lexical :void)) };
11 like($@, qr{:void cannot be used with lexical}, ":void can't be used with :lexical");
13 eval { Fatal->import(qw(open close :lexical)) };
14 like($@, qr{:lexical must be used as first}, ":lexical must come first");
17 use Fatal qw(:lexical chdir);
19 eval { chdir(NO_SUCH_FILE); };
20 like ($@, qr/^Can't chdir/, "Lexical fatal chdir");
22 no Fatal qw(:lexical chdir);
24 eval { chdir(NO_SUCH_FILE); };
25 is ($@, "", "No lexical fatal chdir");
29 eval { chdir(NO_SUCH_FILE); };
30 is($@, "", "Lexical chdir becomes non-fatal out of scope.");
32 eval { Fatal->import('2+2'); };
33 like($@,qr{Bad subroutine name},"Can't use fatal with invalid sub names");