5 unshift @INC, '../lib';
7 $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
11 $runme = ($^O eq 'VMS' ? 'MCR ' : '') . $^X;
16 open OP, qq{$runme -le "print 'aaa Ok ok' for 1..100"|};
18 @chopar = (113 .. 119);
26 @simple_input = grep /^\s*\w+\s*\$\w+\s*[#\n]/, @INPUT;
27 print "1..", (10 + @INPUT + @simple_input), "\n";
32 # Check correct optimization of ucfirst etc
36 print "not " unless $b eq 'Ab';
39 # Check correct destruction of objects:
41 sub A::DESTROY {$dc += 1}
44 { my $c = 6; $b = bless \$c, "A"}
47 print "not " unless $dc == 0;
53 print "not " unless $dc == 1;
58 $xxx = 'c' . ($xxx || 'e');
59 print "not " unless $xxx eq 'cb';
62 { # Check calling STORE
64 sub B::TIESCALAR {bless [11], 'B'}
65 sub B::FETCH { -(shift->[0]) }
66 sub B::STORE { $sc++; my $o = shift; $o->[0] = 17 + shift }
73 print "not " unless $sc == 1;
80 print "not " unless $sc == 2;
84 print "# $m\nnot " unless $m == -117;
90 print "not " unless $sc == 3;
94 print "# $m\nnot " unless $m == 89;
99 # Chains of assignments
101 my ($l1, $l2, $l3, $l4);
103 $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 1 + $zzzz;
106 print "# $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 13\nnot "
107 unless $zzz1 == 13 and $zzz2 == 13 and $l1 == 13
108 and $l2 == 13 and $l3 == 13 and $l4 == 13;
113 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
114 $comment = $op unless defined $comment;
116 $op = "$op==$op" unless $op =~ /==/;
117 ($op, $expectop) = $op =~ /(.*)==(.*)/;
119 $skip = ($op =~ /^'\?\?\?'/ or $comment =~ /skip\(.*\Q$^O\E.*\)/i)
120 ? "skip" : "# '$_'\nnot";
121 $integer = ($comment =~ /^i_/) ? "use integer" : '' ;
122 (print "#skipping $comment:\nok $ord\n"), next if $skip eq 'skip';
125 local \$SIG{__WARN__} = \\&wrn;
131 print "# \$comment: got `\$a', expected `\$b'\n";
132 print "\$skip " if \$a ne \$b or \$skip eq 'skip';
137 if ($@ =~ /is unimplemented/) {
138 print "# skipping $comment: unimplemented:\nok $ord\n";
141 print "# '$_'\nnot ok $ord\n";
146 for (@simple_input) {
148 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
149 $comment = $op unless defined $comment;
151 ($operator, $variable) = /^\s*(\w+)\s*\$(\w+)/ or warn "misprocessed '$_'\n";
153 local \$SIG{__WARN__} = \\&wrn;
154 my \$$variable = "Ac# Ca\\nxxx";
155 \$$variable = $operator \$$variable;
156 \$toself = \$$variable;
157 \$direct = $operator "Ac# Ca\\nxxx";
158 print "# \\\$$variable = $operator \\\$$variable\\nnot "
159 unless \$toself eq \$direct;
163 if ($@ =~ /is unimplemented/) {
164 print "# skipping $comment: unimplemented:\nok $ord\n";
165 } elsif ($@ =~ /Can't (modify|take log of 0)/) {
166 print "# skipping $comment: syntax not good for selfassign:\nok $ord\n";
169 print "# '$_'\nnot ok $ord\n";
175 ref $cstr # ref nonref
176 `$runme -e "print qq[1\n]"` # backtick skip(MSWin32)
177 `$undefed` # backtick undef skip(MSWin32)
181 (@z = (1 .. 3)) # aassign
183 (chop (@x=@chopar)) # schop
184 chomp $chopit # chomp
185 (chop (@x=@chopar)) # schomp
187 pos $chopit # pos returns undef
205 $n . $a=='2fake' # concat with self
206 "3$a"=='3fake' # concat with self in stringify
208 $n << $n # left_shift
209 $n >> $n # right_shift
230 length $posstr # length
231 substr $posstr, 2, 2 # substr
233 index $posstr, 2 # index
234 rindex $posstr, 2 # rindex
235 sprintf "%i%i", $n, $n # sprintf
239 ucfirst ($cstr . "a") # ucfirst padtmp
240 ucfirst $cstr # ucfirst
241 lcfirst $cstr # lcfirst
244 quotemeta $cstr # quotemeta
246 @$undefed # rv2av undef
251 pack "C2", $n,$n # pack
252 split /a/, "abad" # split
255 unshift @aaa # unshift
257 reverse $cstr # reverse - scal
258 grep $_, 1,0,2,0,3 # grepwhile
259 map "x$_", 1,0,2,0,3 # mapwhile
262 warn "ignore this\n" # warn
264 open BLAH, "<non-existent" # open
265 fileno STDERR # fileno
267 select STDOUT # sselect
268 select "","","",0 # select
285 chdir 'non-existent' # chdir
288 unlink 'non-existent' # unlink
289 chmod 'non-existent' # chmod
290 utime 'non-existent' # utime
291 rename 'non-existent', 'non-existent1' # rename
292 link 'non-existent', 'non-existent1' # link
294 readlink 'non-existent', 'non-existent1' # readlink
301 system "$runme -e 0" # system skip(VMS)
307 getpriority $$, $$ # getpriority
310 localtime $^T # localtime