xref: /openbsd-src/gnu/usr.bin/perl/t/op/print.t (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1#!./perl
2
3BEGIN {
4    require "test.pl";
5}
6
7plan(3);
8
9fresh_perl_is('$_ = qq{OK\n}; print;', "OK\n", {},
10              'print without arguments outputs $_');
11fresh_perl_is('$_ = qq{OK\n}; print STDOUT;', "OK\n", {},
12              'print with only a filehandle outputs $_');
13SKIP: {
14    skip_if_miniperl('no dynamic loading of PerlIO::scalar in miniperl');
15fresh_perl_is(<<'EOF', "\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3", {}, "print doesn't launder utf8 overlongs");
16use strict;
17use warnings;
18
19no warnings 'utf8';
20
21# These form overlong "oops"
22open my $fh, "<:utf8", \"\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3"
23    or die "Could not open\n";
24read($fh, my $s, 10) or die "Could not read\n";
25print $s;
26EOF
27
28}
29