17 open OP, qq{$runme -le "print 'aaa Ok ok' for 1..100"|};
19 @chopar = (113 .. 119);
27 @simple_input = grep /^\s*\w+\s*\$\w+\s*[#\n]/, @INPUT;
31 # Check correct optimization of ucfirst etc
34 is( $b, 'Ab', 'Check correct optimization of ucfirst, etc');
36 # Check correct destruction of objects:
38 sub A::DESTROY {$dc += 1}
41 { my $c = 6; $b = bless \$c, "A"}
43 is($dc, 0, 'No destruction yet');
47 is($dc, 1, 'object descruction via reassignment to variable');
50 $xxx = 'c' . ($xxx || 'e');
51 is( $xxx, 'cb', 'variables can be read before being overwritten');
53 { # Check calling STORE
54 note('Tied variables, calling STORE');
56 sub B::TIESCALAR {bless [11], 'B'}
57 sub B::FETCH { -(shift->[0]) }
58 sub B::STORE { $sc++; my $o = shift; $o->[0] = 17 + shift }
64 is( $sc, 1, 'STORE called when assigning scalar to tied variable' );
69 is( $sc, 2, 'and again' );
70 is( $m, -117, 'checking the tied variable result' );
74 is( $sc, 3, 'called on self-increment' );
75 is( $m, 89, 'checking the tied variable result' );
79 # Chains of assignments
81 my ($l1, $l2, $l3, $l4);
83 $zzz1 = $l1 = $l2 = $zzz2 = $l3 = $l4 = 1 + $zzzz;
85 is($zzz1, 13, 'chain assignment, part1');
86 is($zzz2, 13, 'chain assignment, part2');
87 is($l1, 13, 'chain assignment, part3');
88 is($l2, 13, 'chain assignment, part4');
89 is($l3, 13, 'chain assignment, part5');
90 is($l4, 13, 'chain assignment, part6');
93 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
94 $comment = $op unless defined $comment;
96 $op = "$op==$op" unless $op =~ /==/;
97 ($op, $expectop) = $op =~ /(.*)==(.*)/;
99 $skip = ($op =~ /^'\?\?\?'/ or $comment =~ /skip\(.*\Q$^O\E.*\)/i)
100 ? "skip" : "# '$_'\nnot";
101 $integer = ($comment =~ /^i_/) ? "use integer" : '' ;
102 if ($skip eq 'skip') {
111 local \$SIG{__WARN__} = \\&wrn;
118 skip "\$comment: got '\$a', expected '\$b'", 1;
127 if ($@ =~ /is unimplemented/) {
133 fail($_ . ' ' . $warning);
138 for (@simple_input) {
139 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
140 $comment = $op unless defined $comment;
142 ($operator, $variable) = /^\s*(\w+)\s*\$(\w+)/ or warn "misprocessed '$_'\n";
144 local \$SIG{__WARN__} = \\&wrn;
145 my \$$variable = "Ac# Ca\\nxxx";
146 \$$variable = $operator \$$variable;
147 \$toself = \$$variable;
148 \$direct = $operator "Ac# Ca\\nxxx";
149 is(\$toself, \$direct);
154 if ($@ =~ /is unimplemented/) {
159 } elsif ($@ =~ /Can't (modify|take log of 0)/) {
161 skip $warning . ' ' . $comment . ' syntax not good for selfassign', 1;
165 ##Something bad happened
166 fail($_ . ' ' . $warning);
172 sub PVBM () { 'foo' }
177 my $pvlv = \substr $str, 0, 1;
182 is($@, '', 'ex-PVBM assert'.$@);
188 ref $cstr # ref nonref
189 `$runme -e "print qq[1\\n]"` # backtick skip(MSWin32)
190 `$undefed` # backtick undef skip(MSWin32)
194 (@z = (1 .. 3)) # aassign
196 (chop (@x=@chopar)) # schop
197 chomp $chopit # chomp
198 (chop (@x=@chopar)) # schomp
200 pos $chopit # pos returns undef
218 $n . $a=='2fake' # concat with self
219 "3$a"=='3fake' # concat with self in stringify
221 $n << $n # left_shift
222 $n >> $n # right_shift
243 length $posstr # length
244 substr $posstr, 2, 2 # substr
246 index $posstr, 2 # index
247 rindex $posstr, 2 # rindex
248 sprintf "%i%i", $n, $n # sprintf
252 ucfirst ($cstr . "a") # ucfirst padtmp
253 ucfirst $cstr # ucfirst
254 lcfirst $cstr # lcfirst
257 quotemeta $cstr # quotemeta
259 @$undefed # rv2av undef
260 (each %h) % 2 == 1 # each
264 pack "C2", $n,$n # pack
265 split /a/, "abad" # split
268 unshift @aaa # unshift
270 reverse $cstr # reverse - scal
271 grep $_, 1,0,2,0,3 # grepwhile
272 map "x$_", 1,0,2,0,3 # mapwhile
275 warn "ignore this\n" # warn
277 open BLAH, "<non-existent" # open
278 fileno STDERR # fileno
280 select STDOUT # sselect
281 select undef,undef,undef,0 # select
298 chdir 'non-existent' # chdir
301 unlink 'non-existent' # unlink
302 chmod 'non-existent' # chmod
303 utime 'non-existent' # utime
304 rename 'non-existent', 'non-existent1' # rename
305 link 'non-existent', 'non-existent1' # link
307 readlink 'non-existent', 'non-existent1' # readlink
314 system "$runme -e 0" # system skip(VMS)
320 getpriority $$, $$ # getpriority
323 localtime $^T # localtime
325 '???' # sleep: can randomly fail