This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip over state declarations at run time
[perl5.git] / t / op / print.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     require "./test.pl";
6 }
7
8 plan(3);
9
10 fresh_perl_is('$_ = qq{OK\n}; print;', "OK\n", {},
11               'print without arguments outputs $_');
12 fresh_perl_is('$_ = qq{OK\n}; print STDOUT;', "OK\n", {},
13               'print with only a filehandle outputs $_');
14 SKIP: {
15     skip_if_miniperl('no dynamic loading of PerlIO::scalar in miniperl');
16 fresh_perl_is(<<'EOF', "\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3", {}, "print doesn't launder utf8 overlongs");
17 use strict;
18 use warnings;
19
20 no warnings 'utf8';
21
22 # These form overlong "oops"
23 open my $fh, "<:utf8", \"\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3"
24     or die "Could not open\n";
25 read($fh, my $s, 10) or die "Could not read\n";
26 print $s;
27 EOF
28
29 }