-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Feature RequestNew feature or requestNew feature or request
Description
When mocking a directory and a file in the same directory we can then see . and ..
but unfortunately we have no way to mock them and they should be also provided/mocked for free for us by the directory / file
use Test::MockFile qw/strict/;
my $d = Test::MockFile->dir("/there");
my $f = Test::MockFile->file("/there/xyz" => q[...]);
opendir( my $dh, "/there") or return;
foreach my $f ( readdir($dh) ) {
say $f
} output
.
..
xyz
use Test::MockFile qw/strict/;
my $d = Test::MockFile->dir("/there");
my $f = Test::MockFile->file("/there/xyz" => q[...]);
opendir( my $dh, "/there") or return;
foreach my $f ( readdir($dh) ) {
-e "/there/$f"
} output
$>perl foo.pl
Use of stat to access unmocked file or directory '/there/.' in strict mode at foo.pl line 8 at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/Test/MockFile.pm line 238.
Test::MockFile::_strict_mode_violation("stat", ARRAY(0xd4a360)) called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/Test/MockFile.pm line 1150
Test::MockFile::_real_file_access_hook("stat", ARRAY(0xd4a360)) called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/Test/MockFile.pm line 612
Test::MockFile::_mock_stat("stat", "/there/.") called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/x86_64-linux-64int/Overload/FileCheck.pm line 295
Overload::FileCheck::_check_from_stat("e", "/there/.", CODE(0xc2a408)) called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/x86_64-linux-64int/Overload/FileCheck.pm line 265
Overload::FileCheck::__ANON__("e", "/there/.") called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/x86_64-linux-64int/Overload/FileCheck.pm line 210
Overload::FileCheck::__ANON__("/there/.") called at /usr/local/cpanel/3rdparty/perl/532/lib/perl5/cpanel_lib/x86_64-linux-64int/Overload/FileCheck.pm line 586
Overload::FileCheck::_check(275, "/there/.") called at foo.pl line 8
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Feature RequestNew feature or requestNew feature or request