-
-
Save wchristian/1103863 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
äöü |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.010; | |
use Test::More; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 7, 'normal'; | |
} | |
use utf8::all; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'utf8'; | |
} | |
use autodie; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'autodie on'; | |
} | |
no autodie; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'autodie off'; | |
} | |
done_testing(); | |
$ENV{PERL_UNICODE} = 'DAS'; | |
system( $^X, "utf8_autodie_env.t" ); | |
delete $ENV{PERL_UNICODE}; | |
$ENV{PERLIO} = ':utf8'; | |
system( $^X, "utf8_autodie_env.t" ); | |
__END__ | |
D:\utf8>perl utf8_autodie.t | |
ok 1 - normal | |
ok 2 - utf8 | |
not ok 3 - autodie on | |
# Failed test 'autodie on' | |
# at utf8_autodie.t line 24. | |
# got: '7' | |
# expected: '4' | |
ok 4 - autodie off | |
1..4 | |
ok 1 - with_env normal | |
not ok 2 - with_env autodie on | |
# Failed test 'with_env autodie on' | |
# at utf8_autodie_env.t line 16. | |
# got: '7' | |
# expected: '4' | |
ok 3 - with_env no autodie off | |
1..3 | |
# Looks like you failed 1 test of 3. | |
# Looks like you failed 1 test of 4. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.010; | |
use Test::More; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'with_env normal '; | |
} | |
use autodie; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'with_env autodie on'; | |
} | |
no autodie; | |
{ | |
open my $fh, '<', 'text'; | |
my @utf8_lines = <$fh>; | |
is length $utf8_lines[1], 4, 'with_env no autodie off'; | |
} | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment