This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove full stop in the 'try' feature heading
[perl5.git] / t / op / print.t
CommitLineData
a9bec287
GG
1#!./perl
2
3BEGIN {
b5efbd1f 4 chdir 't' if -d 't';
1ae3d757 5 require "./test.pl";
a9bec287
GG
6}
7
0ae1fa71 8plan(3);
a9bec287 9
de482fd5 10fresh_perl_is('$_ = qq{OK\n}; print;', "OK\n", {},
a9bec287 11 'print without arguments outputs $_');
de482fd5 12fresh_perl_is('$_ = qq{OK\n}; print STDOUT;', "OK\n", {},
a9bec287 13 'print with only a filehandle outputs $_');
0ae1fa71
CH
14SKIP: {
15 skip_if_miniperl('no dynamic loading of PerlIO::scalar in miniperl');
4e3e2cbb
KW
16 if ($::IS_ASCII) {
17 fresh_perl_is(<<'EOF', "\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3", {}, "print doesn't launder utf8 overlongs");
0ae1fa71
CH
18use strict;
19use warnings;
20
21no warnings 'utf8';
22
23# These form overlong "oops"
24open my $fh, "<:utf8", \"\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3"
25 or die "Could not open\n";
26read($fh, my $s, 10) or die "Could not read\n";
27print $s;
28EOF
4e3e2cbb
KW
29 }
30 else {
31 fresh_perl_is(<<'EOF', "\x76\x41\x76\x41\x77\x42\x77\x43", {}, "print doesn't launder utf8 overlongs");
32use strict;
33use warnings;
0ae1fa71 34
4e3e2cbb
KW
35no warnings 'utf8';
36
37# These form overlong "oops"
38open my $fh, "<:utf8", \"\x76\x41\x76\x41\x77\x42\x77\x43"
39 or die "Could not open\n";
40read($fh, my $s, 10) or die "Could not read\n";
41print $s;
42EOF
43 }
0ae1fa71 44}