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;
115 $op = "$op==$op" unless $op =~ /==/;
116 ($op, $expectop) = $op =~ /(.*)==(.*)/;
118 $skip = ($op =~ /^'\?\?\?'/ or $comment =~ /skip\(.*\Q$^O\E.*\)/i)
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 "not ok $ord\n";
145 for (@simple_input) {
147 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
148 $comment = $op unless defined $comment;
149 ($operator, $variable) = /^\s*(\w+)\s*\$(\w+)/ or warn "misprocessed '$_'\n";
151 local \$SIG{__WARN__} = \\&wrn;
152 my \$$variable = "Ac# Ca\\nxxx";
153 \$$variable = $operator \$$variable;
154 \$toself = \$$variable;
155 \$direct = $operator "Ac# Ca\\nxxx";
156 print "# \\\$$variable = $operator \\\$$variable\\nnot "
157 unless \$toself eq \$direct;
161 if ($@ =~ /is unimplemented/) {
162 print "# skipping $comment: unimplemented:\nok $ord\n";
163 } elsif ($@ =~ /Can't (modify|take log of 0)/) {
164 print "# skipping $comment: syntax not good for selfassign:\nok $ord\n";
167 print "not ok $ord\n";
173 ref $cstr # ref nonref
174 `$runme -e "print qq[1\n]"` # backtick skip(MSWin32)
175 `$undefed` # backtick undef skip(MSWin32)
179 (@z = (1 .. 3)) # aassign
181 (chop (@x=@chopar)) # schop
182 chomp $chopit # chomp
183 (chop (@x=@chopar)) # schomp
185 pos $chopit # pos returns undef
203 $n . $a=='2fake' # concat with self
204 "3$a"=='3fake' # concat with self in stringify
206 $n << $n # left_shift
207 $n >> $n # right_shift
228 length $posstr # length
229 substr $posstr, 2, 2 # substr
231 index $posstr, 2 # index
232 rindex $posstr, 2 # rindex
233 sprintf "%i%i", $n, $n # sprintf
237 ucfirst ($cstr . "a") # ucfirst padtmp
238 ucfirst $cstr # ucfirst
239 lcfirst $cstr # lcfirst
242 quotemeta $cstr # quotemeta
244 @$undefed # rv2av undef
249 pack "C2", $n,$n # pack
250 split /a/, "abad" # split
253 unshift @aaa # unshift
255 reverse $cstr # reverse - scal
256 grep $_, 1,0,2,0,3 # grepwhile
257 map "x$_", 1,0,2,0,3 # mapwhile
260 warn "ignore this\n" # warn
262 open BLAH, "<non-existent" # open
263 fileno STDERR # fileno
265 select STDOUT # sselect
266 select "","","",0 # select
283 chdir 'non-existent' # chdir
286 unlink 'non-existent' # unlink
287 chmod 'non-existent' # chmod
288 utime 'non-existent' # utime
289 rename 'non-existent', 'non-existent1' # rename
290 link 'non-existent', 'non-existent1' # link
292 readlink 'non-existent', 'non-existent1' # readlink
299 system "$runme -e 0" # system skip(VMS)
305 getpriority $$, $$ # getpriority
308 localtime $^T # localtime