forked from evalEmpire/perl5i
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utf8.t
37 lines (26 loc) · 756 Bytes
/
utf8.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
# perl5i turns on utf8
use strict;
use warnings;
use PerlIO;
use Test::More;
# Test with it on
{
use perl5i::latest;
is "perl5i is MËTÁŁ"->length, 15;
# Test the standard handles and all newly opened handles are utf8
ok open my $test_fh, ">", "perlio_test";
END { unlink "perlio_test" }
for my $fh (*STDOUT, *STDIN, *STDERR, $test_fh) {
my @layers = PerlIO::get_layers($fh);
ok(@layers->grep(qr/utf8/)->flatten) or diag explain { $fh => \@layers };
}
}
# And off
{
ok open my $test_fh, ">", "perlio_test2";
END { unlink "perlio_test2" }
my @layers = PerlIO::get_layers($test_fh);
ok( !grep /utf8/, @layers ) or diag explain { $test_fh => \@layers };
}
done_testing;