1#!./perl -w
2use strict;
3
4use Test::More;
5use 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
10is($INC{'Symbol.pm'}, undef, "Symbol isn't loaded yet");
11
12# ID 20011110.104 (RT #7896)
13$! = 0;
14is($!, '', '$! is empty');
15is(File::stat::stat('/notafile'), undef, 'invalid file should fail');
16isnt($!, '', 'should populate $!, given invalid file');
17my $e = $!;
18
19isnt($INC{'Symbol.pm'}, undef, "Symbol has been loaded");
20
21# Repeat twice
22is(File::stat::stat('/notafile'), undef, 'invalid file should fail again');
23is($!, $e, '$! should be consistent for an invalid file');
24$e = $!;
25is(File::stat::stat('/notafile'), undef, 'invalid file should fail again');
26is($!, $e, '$! should be consistent for an invalid file');
27
28done_testing();
29