Cwd-utf8

 view release on metacpan or  search on metacpan

t/cwd.t  view on Meta::CPAN

my $unicode_dir   = "\x{30c6}\x{30b9}\x{30c8}\x{30c6}\x{3099}\x{30a3}\x{30ec}\x{30af}\x{30c8}\x{30ea}";

mkdir "$test_root/$unicode_dir"
    or die "Unable to create directory $test_root/$unicode_dir: $!"
    unless -d "$test_root/$unicode_dir";

# Check utf8 and non-utf8 results
sub check_dirs {
    my ($test, $utf8, $non_utf8) = @_;
    my $utf8_encoded     = encode_utf8($utf8);
    my $non_utf8_decoded = decode_utf8($non_utf8, FB_CROAK | LEAVE_SRC);

    plan tests => 3;

    like $utf8 => qr/\/$unicode_dir$/, "$test found correct dir";
    is   $utf8_encoded => $non_utf8,   "$test encoded utf8 dir matches non-utf8";
    is   $utf8 => $non_utf8_decoded,   "$test utf8 dir matches decoded non-utf8";
}

plan tests => 9;

use Cwd;
my $currentdir = getcwd();

# Test getcwd, cwd, fastgetcwd, fastcwd
chdir("$test_root/$unicode_dir") or die "Couldn't chdir to $test_root/$unicode_dir: $!";
for my $test (qw(getcwd cwd fastgetcwd fastcwd)) {



( run in 1.929 second using v1.01-cache-2.11-cpan-39bf76dae61 )