Beagle
view release on metacpan or search on metacpan
t/cli/80.locale.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Beagle::Util;
use Beagle::Test;
use Test::Script::Run ':all';
use Encode;
use I18N::Langinfo 'langinfo', 'CODESET';
my $codeset = langinfo(CODESET);
unless ( $codeset && $codeset =~ /utf-8/i ) {
plan skip_all => 'not utf-8 system';
exit;
}
$ENV{BEAGLE_CACHE} = 1;
my $beagle_cmd = Beagle::Test->beagle_command;
Beagle::Test->init_kennel;
run_ok( $beagle_cmd, [qw/init --name ç²ä¹/], 'init ç²ä¹' );
is( last_script_stdout(), 'initialized.' . newline(), 'init output' );
run_ok( $beagle_cmd, [qw/rename ç²ä¹ ä¸ä¸/], 'rename foo to ä¸ä¸' );
is(
last_script_stdout(),
'renamed ç²ä¹ to ä¸ä¸.' . newline(),
'rename output'
);
$ENV{BEAGLE_NAME} = 'ä¸ä¸';
run_ok( $beagle_cmd, [qw/which/], 'which cmd' );
is( last_script_stdout(), 'ä¸ä¸' . newline(), 'current beagle' );
run_ok( $beagle_cmd, [qw/bark test -n ä¸ä¸/], 'create bark' );
ok( last_script_stdout() =~ /^created (\w{32}).\s+$/, 'create bark output' );
opendir my $dh, catdir( $ENV{BEAGLE_KENNEL}, 'cache' );
my ($file) =
map { decode( locale_fs => $_ ) }
grep { $_ ne '.' && $_ ne '..' } readdir $dh;
is( $file, decode( 'utf8', 'ä¸ä¸.drafts' ), 'cache is enabled' );
run_ok( $beagle_cmd, [qw/unfollow ä¸ä¸/], 'create bark' );
is(
last_script_stdout(),
'unfollowed ä¸ä¸.' . newline(),
'unfollow ä¸ä¸ output'
);
opendir $dh, catdir( $ENV{BEAGLE_KENNEL}, 'cache' );
ok( !( grep { $_ ne '.' && $_ ne '..' } readdir $dh ), 'cache is deleted' );
done_testing();
( run in 1.243 second using v1.01-cache-2.11-cpan-ceb78f64989 )