Aion-Fs
view release on metacpan or search on metacpan
t/aion/fs.t view on Meta::CPAN
::done_testing; }; subtest 'goto_editor ($path, $line)' => sub {
goto_editor "mypath", 10;
local ($::_g0 = do {cat "ed.txt"}, $::_e0 = "mypath:10\n"); ::ok $::_g0 eq $::_e0, 'cat "ed.txt" # => mypath:10\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
::like scalar do {eval { goto_editor "`", 1 }; $@}, qr{`:1 --> 512}, 'eval { goto_editor "`", 1 }; $@ # ~> `:1 --> 512'; undef $::_g0; undef $::_e0;
#
# ## from_pkg (;$pkg)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'from_pkg (;$pkg)' => sub {
local ($::_g0 = do {from_pkg "Aion::Fs"}, $::_e0 = "Aion/Fs.pm"); ::ok $::_g0 eq $::_e0, 'from_pkg "Aion::Fs" # => Aion/Fs.pm' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {[map from_pkg, "Aion::Fs", "A::B::C"]}, $::_e0 = do {["Aion/Fs.pm", "A/B/C.pm"]}); ::is_deeply $::_g0, $::_e0, '[map from_pkg, "Aion::Fs", "A::B::C"] # --> ["Aion/Fs.pm", "A/B/C.pm"]' or ::diag ::_struct_diff($::_g0, $::_e0); und...
#
# ## to_pkg (;$path)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'to_pkg (;$path)' => sub {
local ($::_g0 = do {to_pkg "Aion/Fs.pm"}, $::_e0 = "Aion::Fs"); ::ok $::_g0 eq $::_e0, 'to_pkg "Aion/Fs.pm" # => Aion::Fs' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {[map to_pkg, "Aion/Fs.md", "A/B/C.md"]}, $::_e0 = do {["Aion::Fs", "A::B::C"]}); ::is_deeply $::_g0, $::_e0, '[map to_pkg, "Aion/Fs.md", "A/B/C.md"] # --> ["Aion::Fs", "A::B::C"]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $...
#
# ## from_inc (;$pkg)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿Ð°ÐºÐµÑ Ð² пÑÑÑ Ð¤Ð¡ в `@INC`. Файл Ñ Ð¿Ð°ÐºÐµÑом должен ÑÑÑеÑÑвоваÑÑ Ð² одном из пÑÑей `@INC`. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'from_inc (;$pkg)' => sub {
local ($::_g0 = do {from_inc "Aion::Fs"}, $::_e0 = do {$INC{'Aion/Fs.pm'}}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'from_inc "Aion::Fs" # -> $INC{\'Aion/Fs.pm\'}' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $:...
local ($::_g0 = do {[map from_inc, "A::B::C", "Aion::Fs"]}, $::_e0 = do {[$INC{'Aion/Fs.pm'}]}); ::is_deeply $::_g0, $::_e0, '[map from_inc, "A::B::C", "Aion::Fs"] # --> [$INC{\'Aion/Fs.pm\'}]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0;...
local ($::_g0 = do {from_inc "A::B::C"}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'from_inc "A::B::C" # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## to_inc (;$path)
#
# ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ Ð¿ÑÑÑ Ð¸Ð· ФС в `@INC` в пакеÑ. Ðез паÑамеÑÑа иÑполÑзÑÐµÑ `$_`.
#
::done_testing; }; subtest 'to_inc (;$path)' => sub {
local ($::_g0 = do {to_inc $INC{'Aion/Fs.pm'}}, $::_e0 = "Aion::Fs"); ::ok $::_g0 eq $::_e0, 'to_inc $INC{\'Aion/Fs.pm\'} # => Aion::Fs' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {[map to_inc,"A/B/C.pm", $INC{'Aion/Fs.pm'}]}, $::_e0 = do {["Aion::Fs"]}); ::is_deeply $::_g0, $::_e0, '[map to_inc,"A/B/C.pm", $INC{\'Aion/Fs.pm\'}] # --> ["Aion::Fs"]' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; und...
local ($::_g0 = do {to_inc 'Aion/Fs.pm'}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'to_inc \'Aion/Fs.pm\' # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## ilay (;$path)
#
# СоздаÑÑ ÑайловÑй деÑкÑипÑоÑ. Ðн ÑÐ¼ÐµÐµÑ Ð·Ð°ÐºÑÑваÑÑÑÑ, как ÑолÑко на него иÑÑÐµÐ·Ð½ÐµÑ Ð¿Ð¾ÑледнÑÑ ÑÑÑлка.
#
# Так же Ð¸Ð¼ÐµÐµÑ Ð¼ÐµÑод `path`, к-й возвÑаÑÐ°ÐµÑ Ð¿ÑÑÑ Ðº ÑайлÑ.
#
::done_testing; }; subtest 'ilay (;$path)' => sub {
my $test_file = "test_ilay_complete.txt";
my $f = ilay $test_file;
print $f "Line 1\n";
print $f "Line 2\n";
my $std = select $f; $| = 1; select $std;
local ($::_g0 = do {-s $f}, $::_e0 = do {14}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '-s $f # -> 14' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {$f->path}, $::_e0 = "test_ilay_complete.txt"); ::ok $::_g0 eq $::_e0, '$f->path # => test_ilay_complete.txt' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {fileno($f) > 0}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'fileno($f) > 0 # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
undef $f;
local ($::_g0 = do {cat $test_file}, $::_e0 = "Line 1\nLine 2\n"); ::ok $::_g0 eq $::_e0, 'cat $test_file # => Line 1\nLine 2\n' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local $_ = [$test_file, ':raw'];
my $f = ilay;
my $str = "string";
my $num = 42;
my $end = "END";
*FD = *$f{IO};
format FD =
@<<<<<<<< @||||| @>>>>>
$str, $num, $end
.
write FD;
$str = 'int';
write FD;
undef *FD;
undef $f;
my $table = << 'TABLE';
string 42 END
int 42 END
TABLE
local ($::_g0 = do {cat $test_file}, $::_e0 = do {$table}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'cat $test_file # -> $table' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ### See also
#
# * [IO::Handle](https://perldoc.perl.org/IO::Handle).
#
# ## icat (;$file)
#
# СоздаÑÑ ÑайловÑй деÑкÑипÑÐ¾Ñ Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑÑ Ð°Ð²ÑозакÑÑÑиÑ, как ÑолÑко пÑопадÑÑ Ð¿Ð¾ÑледнÑÑ Ð½Ð° него ÑÑÑлка.
#
# Так же Ð¸Ð¼ÐµÐµÑ Ð¼ÐµÑод `path` возвÑаÑаÑÑий пеÑеданнÑй в него пÑÑÑ.
#
::done_testing; }; subtest 'icat (;$file)' => sub {
local $_ = "test_icat_complete.txt";
lay "Line 1\nLine 2\nLine 3\nBinary\x00\x01\x02";
my $f = icat;
my $bytes = read $f, my $buf, 6;
local ($::_g0 = do {$bytes}, $::_e0 = do {6}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$bytes # -> 6' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {$buf}, $::_e0 = "Line 1"); ::ok $::_g0 eq $::_e0, '$buf # => Line 1' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
local ($::_g0 = do {scalar <$f>}, $::_e0 = do {"\n"}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'scalar <$f> # -> "\n"' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
( run in 1.888 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )