xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/io/print.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gateBEGIN {
4*0Sstevel@tonic-gate    chdir 't' if -d 't';
5*0Sstevel@tonic-gate    @INC = '../lib';
6*0Sstevel@tonic-gate}
7*0Sstevel@tonic-gate
8*0Sstevel@tonic-gateuse strict 'vars';
9*0Sstevel@tonic-gateeval 'use Errno';
10*0Sstevel@tonic-gatedie $@ if $@ and !$ENV{PERL_CORE_MINITEST};
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gateprint "1..19\n";
13*0Sstevel@tonic-gate
14*0Sstevel@tonic-gatemy $foo = 'STDOUT';
15*0Sstevel@tonic-gateprint $foo "ok 1\n";
16*0Sstevel@tonic-gate
17*0Sstevel@tonic-gateprint "ok 2\n","ok 3\n","ok 4\n";
18*0Sstevel@tonic-gateprint STDOUT "ok 5\n";
19*0Sstevel@tonic-gate
20*0Sstevel@tonic-gateopen(foo,">-");
21*0Sstevel@tonic-gateprint foo "ok 6\n";
22*0Sstevel@tonic-gate
23*0Sstevel@tonic-gateprintf "ok %d\n",7;
24*0Sstevel@tonic-gateprintf("ok %d\n",8);
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gatemy @a = ("ok %d%c",9,ord("\n"));
27*0Sstevel@tonic-gateprintf @a;
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gate$a[1] = 10;
30*0Sstevel@tonic-gateprintf STDOUT @a;
31*0Sstevel@tonic-gate
32*0Sstevel@tonic-gate$, = ' ';
33*0Sstevel@tonic-gate$\ = "\n";
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gateprint "ok","11";
36*0Sstevel@tonic-gate
37*0Sstevel@tonic-gatemy @x = ("ok","12\nok","13\nok");
38*0Sstevel@tonic-gatemy @y = ("15\nok","16");
39*0Sstevel@tonic-gateprint @x,"14\nok",@y;
40*0Sstevel@tonic-gate{
41*0Sstevel@tonic-gate    local $\ = "ok 17\n# null =>[\000]\nok 18\n";
42*0Sstevel@tonic-gate    print "";
43*0Sstevel@tonic-gate}
44*0Sstevel@tonic-gate
45*0Sstevel@tonic-gate$\ = '';
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gateif (!exists &Errno::EBADF) {
48*0Sstevel@tonic-gate    print "ok 19 # skipped: no EBADF\n";
49*0Sstevel@tonic-gate} else {
50*0Sstevel@tonic-gate    $! = 0;
51*0Sstevel@tonic-gate    print NONEXISTENT "foo";
52*0Sstevel@tonic-gate    print "not " if ($! != &Errno::EBADF);
53*0Sstevel@tonic-gate    print "ok 19\n";
54*0Sstevel@tonic-gate}
55