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