xref: /openbsd/gnu/usr.bin/perl/t/op/print.t (revision 09467b48)
1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    require "./test.pl";
6}
7
8plan(3);
9
10fresh_perl_is('$_ = qq{OK\n}; print;', "OK\n", {},
11              'print without arguments outputs $_');
12fresh_perl_is('$_ = qq{OK\n}; print STDOUT;', "OK\n", {},
13              'print with only a filehandle outputs $_');
14SKIP: {
15    skip_if_miniperl('no dynamic loading of PerlIO::scalar in miniperl');
16    skip("overlong UTF-8 test is ASCII-centric") if $::IS_EBCDIC;    # Varies depending on code page
17fresh_perl_is(<<'EOF', "\xC1\xAF\xC1\xAF\xC1\xB0\xC1\xB3", {}, "print doesn't launder utf8 overlongs");
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
29
30}
31