[File::Basename]を調べる

use strict;
use warnings;

use File::Basename;

use Test::More;

my $path = 't/file/dir/sample.t';
subtest 'fileparse' => sub {
my ($filename, $directory, $suffix) = fileparse($path);
is $filename => 'sample.t', 'filename';
is $directory => 't/file/dir/', 'directory';
is $suffix => undef, 'suffix';
};

subtest 'fileparse suffixes' => sub {
my ($filename, $directory, $suffix) = fileparse($path, qw/.t/);
is $filename => 'sample', 'filename';
is $directory => 't/file/dir/', 'directory';
is $suffix => '.t', 'suffix';
};

subtest 'basename' => sub {
my $filename = basename($path);
is $filename => 'sample.t', 'filename';
};

subtest 'basename suffix' => sub {
my $filename = basename($path, qw/.t/);
is $filename => 'sample', 'filename';
};

subtest 'fileparse suffiexs2' => sub {
my $prefix_name = join '', (fileparse($path, qw/.t/))[1,0];
is $prefix_name => 't/file/dir/sample';
};

done_testing;

0 件のコメント:

コメントを投稿

.mitmproxyを使ってHTTPSの通信を確認

公式のドキュメント https://docs.mitmproxy.org/stable/ # install ## mac ``` $ brew install mitmproxy ``` ## iPhone ### 証明書 セキュアな通信を傍受するために、プロファイ...