Commit | Line | Data |
---|---|---|
a9bec287 GG |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
b5efbd1f | 4 | chdir 't' if -d 't'; |
1ae3d757 | 5 | require "./test.pl"; |
a9bec287 GG |
6 | } |
7 | ||
0ae1fa71 | 8 | plan(3); |
a9bec287 | 9 | |
de482fd5 | 10 | fresh_perl_is('$_ = qq{OK\n}; print;', "OK\n", {}, |
a9bec287 | 11 | 'print without arguments outputs $_'); |
de482fd5 | 12 | fresh_perl_is('$_ = qq{OK\n}; print STDOUT;', "OK\n", {}, |
a9bec287 | 13 | 'print with only a filehandle outputs $_'); |
0ae1fa71 CH |
14 | SKIP: { |
15 | skip_if_miniperl('no dynamic loading of PerlIO::scalar in miniperl'); | |
9ab822f7 | 16 | skip("overlong UTF-8 test is ASCII-centric") if $::IS_EBCDIC; # Varies depending on code page |
20e5bab4 | 17 | fresh_perl_is(<<'EOF', "\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3", {}, "print doesn't launder utf8 overlongs"); |
0ae1fa71 CH |
18 | use strict; |
19 | use warnings; | |
20 | ||
21 | no warnings 'utf8'; | |
22 | ||
23 | # These form overlong "oops" | |
24 | open my $fh, "<:utf8", \"\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3" | |
25 | or die "Could not open\n"; | |
26 | read($fh, my $s, 10) or die "Could not read\n"; | |
27 | print $s; | |
28 | EOF | |
29 | ||
30 | } |