This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: A surprising segfault
[perl5.git] / t / io / print.t
CommitLineData
8d063cd8
LW
1#!./perl
2
b5fe5ca2
SR
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8use strict 'vars';
43651d81
NC
9eval 'use Errno';
10die $@ if $@ and !$ENV{PERL_CORE_MINITEST};
b5fe5ca2 11
1937c63e 12print "1..21\n";
8d063cd8 13
b5fe5ca2 14my $foo = 'STDOUT';
378cc40b
LW
15print $foo "ok 1\n";
16
17print "ok 2\n","ok 3\n","ok 4\n";
a687059c 18print STDOUT "ok 5\n";
8d063cd8
LW
19
20open(foo,">-");
21print foo "ok 6\n";
22
23printf "ok %d\n",7;
24printf("ok %d\n",8);
25
b5fe5ca2 26my @a = ("ok %d%c",9,ord("\n"));
8d063cd8
LW
27printf @a;
28
29$a[1] = 10;
a687059c 30printf STDOUT @a;
8d063cd8
LW
31
32$, = ' ';
33$\ = "\n";
34
35print "ok","11";
378cc40b 36
b5fe5ca2
SR
37my @x = ("ok","12\nok","13\nok");
38my @y = ("15\nok","16");
378cc40b 39print @x,"14\nok",@y;
009c130f
GS
40{
41 local $\ = "ok 17\n# null =>[\000]\nok 18\n";
42 print "";
43}
b5fe5ca2 44
43651d81
NC
45$\ = '';
46
b5fe5ca2
SR
47if (!exists &Errno::EBADF) {
48 print "ok 19 # skipped: no EBADF\n";
49} else {
50 $! = 0;
3fb41248 51 no warnings 'unopened';
b5fe5ca2
SR
52 print NONEXISTENT "foo";
53 print "not " if ($! != &Errno::EBADF);
54 print "ok 19\n";
55}
1937c63e
TS
56
57{
58 # Change 26009: pp_print didn't extend the stack
59 # before pushing its return value
60 # to make sure only that these obfuscated sentences will not crash.
61
62 map print(reverse), ('')x68;
63 print "ok 20\n";
64
65 map print(+()), ('')x68;
66 print "ok 21\n";
67}