10 $runme = ($^O eq 'VMS' ? 'MCR ' : '') . $^X;
15 open OP, qq{$runme -le "print 'aaa Ok ok' for 1..100"|};
17 @chopar = (113 .. 119);
25 @simple_input = grep /^\s*\w+\s*\$\w+\s*[#\n]/, @INPUT;
26 print "1..", (10 + @INPUT + @simple_input), "\n";
31 # Check correct optimization of ucfirst etc
35 print "not " unless $b eq 'Ab';
38 # Check correct destruction of objects:
40 sub A::DESTROY {$dc += 1}
43 { my $c = 6; $b = bless \$c, "A"}
46 print "not " unless $dc == 0;
52 print "not " unless $dc == 1;
57 $xxx = 'c' . ($xxx || 'e');
58 print "not " unless $xxx eq 'cb';
61 { # Check calling STORE
63 sub B::TIESCALAR {bless [11], 'B'}
64 sub B::FETCH { -(shift->[0]) }
65 sub B::STORE { $sc++; my $o = shift; $o->[0] = 17 + shift }
72 print "not " unless $sc == 1;
79 print "not " unless $sc == 2;
83 print "# $m\nnot " unless $m == -117;
89 print "not " unless $sc == 3;
93 print "# $m\nnot " unless $m == 89;
98 # Chains of assignments
100 my ($l1, $l2, $l3, $l4);
102 $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 1 + $zzzz;
105 print "# $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 13\nnot "
106 unless $zzz1 == 13 and $zzz2 == 13 and $l1 == 13
107 and $l2 == 13 and $l3 == 13 and $l4 == 13;
112 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
113 $comment = $op unless defined $comment;
115 $op = "$op==$op" unless $op =~ /==/;
116 ($op, $expectop) = $op =~ /(.*)==(.*)/;
118 $skip = ($op =~ /^'\?\?\?'/ or $comment =~ /skip\(.*\Q$^O\E.*\)/i)
119 ? "skip" : "# '$_'\nnot";
120 $integer = ($comment =~ /^i_/) ? "use integer" : '' ;
121 (print "#skipping $comment:\nok $ord\n"), next if $skip eq 'skip';
124 local \$SIG{__WARN__} = \\&wrn;
130 print "# \$comment: got `\$a', expected `\$b'\n";
131 print "\$skip " if \$a ne \$b or \$skip eq 'skip';
136 if ($@ =~ /is unimplemented/) {
137 print "# skipping $comment: unimplemented:\nok $ord\n";
140 print "# '$_'\nnot ok $ord\n";
145 for (@simple_input) {
147 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
148 $comment = $op unless defined $comment;
150 ($operator, $variable) = /^\s*(\w+)\s*\$(\w+)/ or warn "misprocessed '$_'\n";
152 local \$SIG{__WARN__} = \\&wrn;
153 my \$$variable = "Ac# Ca\\nxxx";
154 \$$variable = $operator \$$variable;
155 \$toself = \$$variable;
156 \$direct = $operator "Ac# Ca\\nxxx";
157 print "# \\\$$variable = $operator \\\$$variable\\nnot "
158 unless \$toself eq \$direct;
162 if ($@ =~ /is unimplemented/) {
163 print "# skipping $comment: unimplemented:\nok $ord\n";
164 } elsif ($@ =~ /Can't (modify|take log of 0)/) {
165 print "# skipping $comment: syntax not good for selfassign:\nok $ord\n";
168 print "# '$_'\nnot ok $ord\n";
174 ref $cstr # ref nonref
175 `$runme -e "print qq[1\\n]"` # backtick skip(MSWin32)
176 `$undefed` # backtick undef skip(MSWin32)
180 (@z = (1 .. 3)) # aassign
182 (chop (@x=@chopar)) # schop
183 chomp $chopit # chomp
184 (chop (@x=@chopar)) # schomp
186 pos $chopit # pos returns undef
204 $n . $a=='2fake' # concat with self
205 "3$a"=='3fake' # concat with self in stringify
207 $n << $n # left_shift
208 $n >> $n # right_shift
229 length $posstr # length
230 substr $posstr, 2, 2 # substr
232 index $posstr, 2 # index
233 rindex $posstr, 2 # rindex
234 sprintf "%i%i", $n, $n # sprintf
238 ucfirst ($cstr . "a") # ucfirst padtmp
239 ucfirst $cstr # ucfirst
240 lcfirst $cstr # lcfirst
243 quotemeta $cstr # quotemeta
245 @$undefed # rv2av undef
246 (each %h) % 2 == 1 # each
250 pack "C2", $n,$n # pack
251 split /a/, "abad" # split
254 unshift @aaa # unshift
256 reverse $cstr # reverse - scal
257 grep $_, 1,0,2,0,3 # grepwhile
258 map "x$_", 1,0,2,0,3 # mapwhile
261 warn "ignore this\n" # warn
263 open BLAH, "<non-existent" # open
264 fileno STDERR # fileno
266 select STDOUT # sselect
267 select "","","",0 # select
284 chdir 'non-existent' # chdir
287 unlink 'non-existent' # unlink
288 chmod 'non-existent' # chmod
289 utime 'non-existent' # utime
290 rename 'non-existent', 'non-existent1' # rename
291 link 'non-existent', 'non-existent1' # link
293 readlink 'non-existent', 'non-existent1' # readlink
300 system "$runme -e 0" # system skip(VMS)
306 getpriority $$, $$ # getpriority
309 localtime $^T # localtime
311 '???' # sleep: can randomly fail