Commit | Line | Data |
---|---|---|
8d063cd8 LW |
1 | #!./perl |
2 | ||
b5fe5ca2 SR |
3 | BEGIN { |
4 | chdir 't' if -d 't'; | |
5 | @INC = '../lib'; | |
bcf53fae NC |
6 | require './test.pl'; |
7 | eval 'use Errno'; | |
8 | die $@ if $@ and !is_miniperl(); | |
b5fe5ca2 SR |
9 | } |
10 | ||
11 | use strict 'vars'; | |
b5fe5ca2 | 12 | |
87385d72 | 13 | print "1..24\n"; |
8d063cd8 | 14 | |
b5fe5ca2 | 15 | my $foo = 'STDOUT'; |
378cc40b LW |
16 | print $foo "ok 1\n"; |
17 | ||
18 | print "ok 2\n","ok 3\n","ok 4\n"; | |
a687059c | 19 | print STDOUT "ok 5\n"; |
8d063cd8 LW |
20 | |
21 | open(foo,">-"); | |
22 | print foo "ok 6\n"; | |
23 | ||
24 | printf "ok %d\n",7; | |
25 | printf("ok %d\n",8); | |
26 | ||
b5fe5ca2 | 27 | my @a = ("ok %d%c",9,ord("\n")); |
8d063cd8 LW |
28 | printf @a; |
29 | ||
30 | $a[1] = 10; | |
a687059c | 31 | printf STDOUT @a; |
8d063cd8 LW |
32 | |
33 | $, = ' '; | |
34 | $\ = "\n"; | |
35 | ||
36 | print "ok","11"; | |
378cc40b | 37 | |
b5fe5ca2 SR |
38 | my @x = ("ok","12\nok","13\nok"); |
39 | my @y = ("15\nok","16"); | |
378cc40b | 40 | print @x,"14\nok",@y; |
009c130f GS |
41 | { |
42 | local $\ = "ok 17\n# null =>[\000]\nok 18\n"; | |
43 | print ""; | |
44 | } | |
b5fe5ca2 | 45 | |
43651d81 NC |
46 | $\ = ''; |
47 | ||
b5fe5ca2 SR |
48 | if (!exists &Errno::EBADF) { |
49 | print "ok 19 # skipped: no EBADF\n"; | |
50 | } else { | |
51 | $! = 0; | |
3fb41248 | 52 | no warnings 'unopened'; |
b5fe5ca2 SR |
53 | print NONEXISTENT "foo"; |
54 | print "not " if ($! != &Errno::EBADF); | |
55 | print "ok 19\n"; | |
56 | } | |
1937c63e TS |
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 | } | |
69974ce6 FC |
69 | |
70 | # printf with %n | |
71 | my $n = "abc"; | |
72 | printf "ok 22%n - not really a test; just printing\n", substr $n,1,1; | |
73 | print "not " x ($n ne "a5c") . "ok 23 - printf with %n (got $n)\n"; | |
87385d72 FC |
74 | |
75 | # [perl #77094] printf with empty list | |
76 | () = ("not "); | |
77 | printf +(); | |
78 | print "ok 24 - printf +() does not steal stack items\n"; |