1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6 set_up_inc('../lib'); 7 eval 'use Errno'; 8 die $@ if $@ and !is_miniperl(); 9} 10 11use strict 'vars'; 12 13print "1..24\n"; 14 15my $foo = 'STDOUT'; 16print $foo "ok 1\n"; 17 18print "ok 2\n","ok 3\n","ok 4\n"; 19print STDOUT "ok 5\n"; 20 21open(foo,">-"); 22print foo "ok 6\n"; 23 24printf "ok %d\n",7; 25printf("ok %d\n",8); 26 27my @a = ("ok %d%c",9,ord("\n")); 28printf @a; 29 30$a[1] = 10; 31printf STDOUT @a; 32 33$, = ' '; 34$\ = "\n"; 35 36print "ok","11"; 37 38my @x = ("ok","12\nok","13\nok"); 39my @y = ("15\nok","16"); 40print @x,"14\nok",@y; 41{ 42 local $\ = "ok 17\n# null =>[\000]\nok 18\n"; 43 print ""; 44} 45 46$\ = ''; 47 48if (!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} 69 70# printf with %n 71my $n = "abc"; 72printf "ok 22%n - not really a test; just printing\n", substr $n,1,1; 73print "not " x ($n ne "a5c") . "ok 23 - printf with %n (got $n)\n"; 74 75# [perl #77094] printf with empty list 76() = ("not "); 77printf +(); 78print "ok 24 - printf +() does not steal stack items\n"; 79