Aion-Fs
view release on metacpan or search on metacpan
t/aion/fs.t view on Meta::CPAN
local $_ = ["A", 0755];
local ($::_g0 = do {mkpath}, $::_e0 = "A"); ::ok $::_g0 eq $::_e0, 'mkpath # => A' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
::like scalar do {eval { mkpath "/A/" }; $@}, qr{mkpath /A: Permission denied}, 'eval { mkpath "/A/" }; $@ # ~> mkpath /A: Permission denied'; undef $::_g0; undef $::_e0;
mkpath "A///./file";
local ($::_g0 = do {-d "A"}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '-d "A" # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [File::Path](https://metacpan.org/pod/File::Path) â `mkpath("dir1/dir2")`.
# * [File::Path::Tiny](https://metacpan.org/pod/File::Path::Tiny) â `File::Path::Tiny::mk($path)`. Ðе вÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑений.
#
# ## mtime (;$path)
#
# ÐÑÐµÐ¼Ñ Ð¼Ð¾Ð´Ð¸ÑикаÑии `$path` в unixtime Ñ Ð´Ñобной ÑаÑÑÑÑ (из `Time::HiRes::stat`). Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# ÐÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение, еÑли Ñайл не ÑÑÑеÑÑвÑÐµÑ Ð¸Ð»Ð¸ Ð½ÐµÑ Ð¿Ñав:
#
::done_testing; }; subtest 'mtime (;$path)' => sub {
local $_ = "nofile";
::like scalar do {eval { mtime }; $@}, qr{mtime nofile: No such file or directory}, 'eval { mtime }; $@ # ~> mtime nofile: No such file or directory'; undef $::_g0; undef $::_e0;
::like scalar do {mtime ["/"]}, qr{^\d+(\.\d+)?$}, 'mtime ["/"] # ~> ^\d+(\.\d+)?$'; undef $::_g0; undef $::_e0;
#
# ### See also
#
# * `-M` â `-M "file.txt"`, `-M _` в днÑÑ
Ð¾Ñ ÑекÑÑего вÑемени.
# * [stat](https://metacpan.org/pod/stat) â `(stat "file.txt")[9]` в ÑекÑндаÑ
(unixtime).
# * [Time::HiRes](https://metacpan.org/pod/Time::HiRes) â `(Time::HiRes::stat "file.txt")[9]` в ÑекÑндаÑ
Ñ Ð´Ñобной ÑаÑÑÑÑ.
# * [Mojo::File](https://metacpan.org/pod/Mojo::File) â `path($file)->stat->mtime`.
#
# ## sta (;$path)
#
# ÐозвÑаÑÐ°ÐµÑ ÑÑаÑиÑÑÐ¸ÐºÑ Ð¾ Ñайле. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
# ЧÑÐ¾Ð±Ñ Ð¼Ð¾Ð¶Ð½Ð¾ бÑло иÑполÑзоваÑÑ Ñ Ð´ÑÑгими ÑайловÑми ÑÑнкÑиÑми, Ð¼Ð¾Ð¶ÐµÑ Ð¿Ð¾Ð»ÑÑаÑÑ ÑÑÑÐ»ÐºÑ Ð½Ð° маÑÑив из коÑоÑого беÑÑÑ Ð¿ÐµÑвÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð² каÑеÑÑ...
#
# ÐÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение, еÑли Ñайл не ÑÑÑеÑÑвÑÐµÑ Ð¸Ð»Ð¸ Ð½ÐµÑ Ð¿Ñав:
#
::done_testing; }; subtest 'sta (;$path)' => sub {
local $_ = "nofile";
::like scalar do {eval { sta }; $@}, qr{sta nofile: No such file or directory}, 'eval { sta }; $@ # ~> sta nofile: No such file or directory'; undef $::_g0; undef $::_e0;
::like scalar do {sta(["/"])->{ino}}, qr{^\d+$}, 'sta(["/"])->{ino} # ~> ^\d+$'; undef $::_g0; undef $::_e0;
::like scalar do {sta(".")->{atime}}, qr{^\d+(\.\d+)?$}, 'sta(".")->{atime} # ~> ^\d+(\.\d+)?$'; undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [Fcntl](https://metacpan.org/pod/Fcntl) â ÑодеÑÐ¶Ð¸Ñ ÐºÐ¾Ð½ÑÑанÑÑ Ð´Ð»Ñ ÑаÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ Ñежима.
# * [BSD::stat](https://metacpan.org/pod/BSD::stat) â дополниÑелÑно возвÑаÑÐ°ÐµÑ atime, ctime и mtime в наноÑекÑндаÑ
, Ñлаги полÑзоваÑÐµÐ»Ñ Ð¸ Ð½Ð¾Ð¼ÐµÑ Ð³ÐµÐ½ÐµÑаÑии Ñайла. ÐÐ¼ÐµÐµÑ ÐÐ...
# * [File::chmod](https://metacpan.org/pod/File::chmod) â `chmod("o=,g-w","file1","file2")`, `@newmodes = getchmod("+x","file1","file2")`.
# * [File::stat](https://metacpan.org/pod/File::stat) â пÑедоÑÑавлÑÐµÑ ÐÐÐ-инÑеÑÑÐµÐ¹Ñ Ðº stat.
# * [File::Stat::Bits](https://metacpan.org/pod/File::Stat::Bits) â аналогиÑен [Fcntl](https://metacpan.org/pod/Fcntl).
# * [File::stat::Extra](https://metacpan.org/pod/File::stat::Extra) â ÑаÑÑиÑÑÐµÑ [File::stat](https://metacpan.org/pod/File::stat) меÑодами Ð´Ð»Ñ Ð¿Ð¾Ð»ÑÑÐµÐ½Ð¸Ñ Ð¸Ð½ÑоÑмаÑии о Ñежиме, а Ñак же пеÑезаÐ...
# * [File::Stat::Ls](https://metacpan.org/pod/File::Stat::Ls) â возвÑаÑÐ°ÐµÑ Ñежим в ÑоÑмаÑе ÑÑилиÑÑ ls.
# * [File::Stat::Moose](https://metacpan.org/pod/File::Stat::Moose) â ÐÐРинÑеÑÑÐµÐ¹Ñ Ð½Ð° Moose.
# * [File::Stat::OO](https://metacpan.org/pod/File::Stat::OO) â пÑедоÑÑавлÑÐµÑ ÐÐÐ-инÑеÑÑÐµÐ¹Ñ Ðº stat. ÐÐ¾Ð¶ÐµÑ Ð²Ð¾Ð·Ð²ÑаÑаÑÑ atime, ctime и mtime ÑÑÐ°Ð·Ñ Ð² `DateTime`.
# * [File::Stat::Trigger](https://metacpan.org/pod/File::Stat::Trigger) â Ñледилка за изменением аÑÑибÑÑов Ñайла.
# * [Linux::stat](https://metacpan.org/pod/Linux::stat) â паÑÑÐ¸Ñ /proc/stat и возвÑаÑÐ°ÐµÑ Ð´Ð¾Ð¿-инÑоÑмаÑиÑ. Ðднако в дÑÑгиÑ
ÐС не ÑабоÑаеÑ.
# * [Stat::lsMode](https://metacpan.org/pod/Stat::lsMode) â возвÑаÑÐ°ÐµÑ Ñежим в ÑоÑмаÑе ÑÑилиÑÑ ls.
# * [VMS::Stat](https://metacpan.org/pod/VMS::Stat) â возвÑаÑÐ°ÐµÑ ÑпиÑки VMS ACL.
#
# ## path (;$path)
#
# Ð Ð°Ð·Ð±Ð¸Ð²Ð°ÐµÑ ÑайловÑй пÑÑÑ Ð½Ð° ÑоÑÑавлÑÑÑие или ÑобиÑÐ°ÐµÑ ÐµÐ³Ð¾ из ÑоÑÑавлÑÑÑиÑ
.
#
# * ÐÑли полÑÑÐ°ÐµÑ ÑÑÑÐ»ÐºÑ Ð½Ð° маÑÑив, Ñо воÑпÑÐ¸Ð½Ð¸Ð¼Ð°ÐµÑ ÐµÐ³Ð¾ пеÑвÑй ÑÐ»ÐµÐ¼ÐµÐ½Ñ ÐºÐ°Ðº пÑÑÑ.
# * ÐÑли полÑÑÐ°ÐµÑ ÑÑÑÐ»ÐºÑ Ð½Ð° Ñ
ÑÑ, Ñо ÑобиÑÐ°ÐµÑ Ð¸Ð· него пÑÑÑ. ÐезнакомÑе клÑÑи пÑоÑÑо игноÑиÑÑеÑ. ÐÐ°Ð±Ð¾Ñ ÐºÐ»ÑÑей Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð¹ ФС â ÑазнÑй.
# * ФС беÑÑÑÑÑ Ð¸Ð· ÑиÑÑемной пеÑеменной `$^O`.
# * Ð Ñайловой ÑиÑÑеме не обÑаÑаеÑÑÑ.
#
::done_testing; }; subtest 'path (;$path)' => sub {
{
local $^O = "freebsd";
local ($::_g0 = do {path "."}, $::_e0 = do {{path => ".", file => ".", name => "."}}); ::is_deeply $::_g0, $::_e0, ' path "." # --> {path => ".", file => ".", name => "."}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e...
local ($::_g0 = do {path ".bashrc"}, $::_e0 = do {{path => ".bashrc", file => ".bashrc", name => ".bashrc"}}); ::is_deeply $::_g0, $::_e0, ' path ".bashrc" # --> {path => ".bashrc", file => ".bashrc", name => ".bashrc"}' or ::diag ::_struct_diff(...
local ($::_g0 = do {path ".bash.rc"}, $::_e0 = do {{path => ".bash.rc", file => ".bash.rc", name => ".bash", ext => "rc"}}); ::is_deeply $::_g0, $::_e0, ' path ".bash.rc" # --> {path => ".bash.rc", file => ".bash.rc", name => ".bash", ext => "rc"...
local ($::_g0 = do {path ["/"]}, $::_e0 = do {{path => "/", dir => "/"}}); ::is_deeply $::_g0, $::_e0, ' path ["/"] # --> {path => "/", dir => "/"}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local $_ = "";
local ($::_g0 = do {path}, $::_e0 = do {{path => ""}}); ::is_deeply $::_g0, $::_e0, ' path # --> {path => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path "a/b/c.ext.ly"}, $::_e0 = do {{path => "a/b/c.ext.ly", dir => "a/b", file => "c.ext.ly", name => "c", ext => "ext.ly"}}); ::is_deeply $::_g0, $::_e0, ' path "a/b/c.ext.ly" # --> {path => "a/b/c.ext.ly", dir => "a/b", fil...
local ($::_g0 = do {path +{dir => "/", ext => "ext.ly"}}, $::_e0 = "/.ext.ly"); ::ok $::_g0 eq $::_e0, ' path +{dir => "/", ext => "ext.ly"} # => /.ext.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{file => "b.c", ext => "ly"}}, $::_e0 = "b.ly"); ::ok $::_g0 eq $::_e0, ' path +{file => "b.c", ext => "ly"} # => b.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", dir => "m"}}, $::_e0 = "m/f.c"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", dir => "m"} # => m/f.c' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local $_ = +{path => "a/b/f.c", dir => undef, ext => undef};
local ($::_g0 = do {path}, $::_e0 = "f"); ::ok $::_g0 eq $::_e0, ' path # => f' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", volume => "/x", dir => "m/y/", file => "f.y", name => "j", ext => "ext"}}, $::_e0 = "m/y//j.ext"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", volume => "/x", dir => "m/y/", file => "f.y", name ...
local ($::_g0 = do {path +{path => "a/b/f.c", volume => "/x", dir => "/y", file => "f.y", name => "j", ext => "ext"}}, $::_e0 = "/y/j.ext"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", volume => "/x", dir => "/y", file => "f.y", name => "j"...
}
{
local $^O = "MSWin32"; # also os2, symbian and dos
local ($::_g0 = do {path "."}, $::_e0 = do {{path => ".", file => ".", name => "."}}); ::is_deeply $::_g0, $::_e0, ' path "." # --> {path => ".", file => ".", name => "."}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e...
local ($::_g0 = do {path ".bashrc"}, $::_e0 = do {{path => ".bashrc", file => ".bashrc", name => ".bashrc"}}); ::is_deeply $::_g0, $::_e0, ' path ".bashrc" # --> {path => ".bashrc", file => ".bashrc", name => ".bashrc"}' or ::diag ::_struct_diff(...
local ($::_g0 = do {path "/"}, $::_e0 = do {{path => "\\", dir => "\\", folder => "\\"}}); ::is_deeply $::_g0, $::_e0, ' path "/" # --> {path => "\\", dir => "\\", folder => "\\"}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; und...
local ($::_g0 = do {path "\\"}, $::_e0 = do {{path => "\\", dir => "\\", folder => "\\"}}); ::is_deeply $::_g0, $::_e0, ' path "\\" # --> {path => "\\", dir => "\\", folder => "\\"}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; un...
local ($::_g0 = do {path ""}, $::_e0 = do {{path => ""}}); ::is_deeply $::_g0, $::_e0, ' path "" # --> {path => ""}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path "a\\b\\c.ext.ly"}, $::_e0 = do {{path => "a\\b\\c.ext.ly", dir => "a\\b\\", folder => "a\\b", file => "c.ext.ly", name => "c", ext => "ext.ly"}}); ::is_deeply $::_g0, $::_e0, ' path "a\\b\\c.ext.ly" # --> {path => "a\\b\...
local ($::_g0 = do {path +{dir => "/", ext => "ext.ly"}}, $::_e0 = "\\.ext.ly"); ::ok $::_g0 eq $::_e0, ' path +{dir => "/", ext => "ext.ly"} # => \\.ext.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{dir => "\\", ext => "ext.ly"}}, $::_e0 = "\\.ext.ly"); ::ok $::_g0 eq $::_e0, ' path +{dir => "\\", ext => "ext.ly"} # => \\.ext.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{file => "b.c", ext => "ly"}}, $::_e0 = "b.ly"); ::ok $::_g0 eq $::_e0, ' path +{file => "b.c", ext => "ly"} # => b.ly' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", dir => "m/r/"}}, $::_e0 = "m\\r\\f.c"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", dir => "m/r/"} # => m\\r\\f.c' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", dir => undef, ext => undef}}, $::_e0 = "f"); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", dir => undef, ext => undef} # => f' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {path +{path => "a/b/f.c", volume => "x", dir => "m/y/", file => "f.y", name => "j", ext => "ext"}}, $::_e0 = 'x:m\y\j.ext'); ::ok $::_g0 eq $::_e0, ' path +{path => "a/b/f.c", volume => "x", dir => "m/y/", file => "f.y", name =...
local ($::_g0 = do {path +{path => "x:/a/b/f.c", volume => undef, dir => "/y/", file => "f.y", name => "j", ext => "ext"}}, $::_e0 = '\y\j.ext'); ::ok $::_g0 eq $::_e0, ' path +{path => "x:/a/b/f.c", volume => undef, dir => "/y/", file => "f.y",...
}
{
local $^O = "amigaos";
my $path = {
( run in 0.858 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )