This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Some refactoring.
[perl5.git] / lib / File / stat-7896.t
1 #!./perl -w
2 use strict;
3
4 use Test::More;
5 use File::stat;
6
7 # This is possibly a bit black-box, but for now it works.
8 # If (either) File::stat stops lazy loading Symbol, or Test::More starts, it
9 # should be revisited
10 is($INC{'Symbol.pm'}, undef, "Symbol isn't loaded yet");
11
12 # ID 20011110.104 (RT #7896)
13 $! = 0;
14 is($!, '', '$! is empty');
15 is(File::stat::stat('/notafile'), undef, 'invalid file should fail');
16 isnt($!, '', 'should populate $!, given invalid file');
17 my $e = $!;
18
19 isnt($INC{'Symbol.pm'}, undef, "Symbol has been loaded");
20
21 # Repeat twice
22 is(File::stat::stat('/notafile'), undef, 'invalid file should fail again');
23 is($!, $e, '$! should be consistent for an invalid file');
24 $e = $!;
25 is(File::stat::stat('/notafile'), undef, 'invalid file should fail again');
26 is($!, $e, '$! should be consistent for an invalid file');
27
28 done_testing();