more PERL_OBJECT cleanups (changes still untested on Unix!)
[p5sagit/p5-mst-13.2.git] / t / op / lex_assign.t
CommitLineData
317982ac 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
93430cb4 5 unshift @INC, '../lib';
317982ac 6}
7
8umask 0;
9$xref = \ "";
562a7b0c 10$runme = ($^O eq 'VMS' ? 'MCR ' : '') . $^X;
317982ac 11@a = (1..5);
12%h = (1..6);
13$aref = \@a;
14$href = \%h;
562a7b0c 15open OP, qq{$runme -le "print 'aaa Ok ok' for 1..100"|};
317982ac 16$chopit = 'aaaaaa';
17@chopar = (113 .. 119);
18$posstr = '123456';
19$cstr = 'aBcD.eF';
20pos $posstr = 3;
21$nn = $n = 2;
22sub subb {"in s"}
23
24@INPUT = <DATA>;
25print "1..", (scalar @INPUT), "\n";
26$ord = 0;
27
28sub wrn {"@_"}
29
30for (@INPUT) {
31 $ord++;
32 ($op, undef, $comment) = /^([^\#]+)(\#\s+(.*))?/;
33 $comment = $op unless defined $comment;
34 $op = "$op==$op" unless $op =~ /==/;
35 ($op, $expectop) = $op =~ /(.*)==(.*)/;
36
0f4592ef 37 $skip = ($op =~ /^'\?\?\?'/ or $comment =~ /skip\(.*\Q$^O\E.*\)/i)
38 ? "skip" : "not";
317982ac 39 $integer = ($comment =~ /^i_/) ? "use integer" : '' ;
40 (print "#skipping $comment:\nok $ord\n"), next if $skip eq 'skip';
41
42 eval <<EOE;
43 local \$SIG{__WARN__} = \\&wrn;
44 my \$a = 'fake';
45 $integer;
46 \$a = $op;
47 \$b = $expectop;
48 if (\$a ne \$b) {
49 print "# \$comment: got `\$a', expected `\$b'\n";
50 print "\$skip " if \$a ne \$b or \$skip eq 'skip';
51 }
52 print "ok \$ord\\n";
53EOE
54 if ($@) {
55 if ($@ =~ /is unimplemented/) {
56 print "# skipping $comment: unimplemented:\nok $ord\n";
57 } else {
58 warn $@;
59 print "not ok $ord\n";
60 }
61 }
62}
63__END__
64ref $xref # ref
65ref $cstr # ref nonref
562a7b0c 66`$runme -e "print qq[1\n]"` # backtick skip(MSWin32)
0f4592ef 67`$undefed` # backtick undef skip(MSWin32)
317982ac 68<*> # glob
69<OP> # readline
70'faked' # rcatline
71(@z = (1 .. 3)) # aassign
72chop $chopit # chop
73(chop (@x=@chopar)) # schop
74chomp $chopit # chomp
75(chop (@x=@chopar)) # schomp
76pos $posstr # pos
77pos $chopit # pos returns undef
78$nn++==2 # postinc
79$nn++==3 # i_postinc
80$nn--==4 # postdec
81$nn--==3 # i_postdec
82$n ** $n # pow
83$n * $n # multiply
84$n * $n # i_multiply
85$n / $n # divide
86$n / $n # i_divide
87$n % $n # modulo
88$n % $n # i_modulo
89$n x $n # repeat
90$n + $n # add
91$n + $n # i_add
92$n - $n # subtract
93$n - $n # i_subtract
94$n . $n # concat
95$n . $a=='2fake' # concat with self
96"3$a"=='3fake' # concat with self in stringify
97"$n" # stringify
98$n << $n # left_shift
99$n >> $n # right_shift
100$n <=> $n # ncmp
101$n <=> $n # i_ncmp
102$n cmp $n # scmp
103$n & $n # bit_and
104$n ^ $n # bit_xor
105$n | $n # bit_or
106-$n # negate
107-$n # i_negate
108~$n # complement
109atan2 $n,$n # atan2
110sin $n # sin
111cos $n # cos
112'???' # rand
113exp $n # exp
114log $n # log
115sqrt $n # sqrt
116int $n # int
117hex $n # hex
118oct $n # oct
119abs $n # abs
120length $posstr # length
121substr $posstr, 2, 2 # substr
122vec("abc",2,8) # vec
123index $posstr, 2 # index
124rindex $posstr, 2 # rindex
125sprintf "%i%i", $n, $n # sprintf
126ord $n # ord
127chr $n # chr
128crypt $n, $n # crypt
129ucfirst ($cstr . "a") # ucfirst padtmp
130ucfirst $cstr # ucfirst
131lcfirst $cstr # lcfirst
132uc $cstr # uc
133lc $cstr # lc
134quotemeta $cstr # quotemeta
135@$aref # rv2av
136@$undefed # rv2av undef
137each %h==1 # each
138values %h # values
139keys %h # keys
140%$href # rv2hv
141pack "C2", $n,$n # pack
142split /a/, "abad" # split
143join "a"; @a # join
144push @a,3==6 # push
145unshift @aaa # unshift
146reverse @a # reverse
147reverse $cstr # reverse - scal
148grep $_, 1,0,2,0,3 # grepwhile
149map "x$_", 1,0,2,0,3 # mapwhile
150subb() # entersub
151caller # caller
152warn "ignore this\n" # warn
153'faked' # die
154open BLAH, "<non-existent" # open
155fileno STDERR # fileno
156umask 0 # umask
157select STDOUT # sselect
158select "","","",0 # select
159getc OP # getc
160'???' # read
161'???' # sysread
162'???' # syswrite
163'???' # send
164'???' # recv
165'???' # tell
166'???' # fcntl
167'???' # ioctl
168'???' # flock
169'???' # accept
170'???' # shutdown
171'???' # ftsize
172'???' # ftmtime
173'???' # ftatime
174'???' # ftctime
175chdir 'non-existent' # chdir
176'???' # chown
177'???' # chroot
178unlink 'non-existent' # unlink
179chmod 'non-existent' # chmod
180utime 'non-existent' # utime
181rename 'non-existent', 'non-existent1' # rename
182link 'non-existent', 'non-existent1' # link
ecece5d6 183'???' # symlink
317982ac 184readlink 'non-existent', 'non-existent1' # readlink
185'???' # mkdir
186'???' # rmdir
187'???' # telldir
188'???' # fork
189'???' # wait
190'???' # waitpid
562a7b0c 191system "$runme -e 0" # system skip(VMS)
317982ac 192'???' # exec
0f4592ef 193'???' # kill
317982ac 194getppid # getppid
195getpgrp # getpgrp
196'???' # setpgrp
197getpriority $$, $$ # getpriority
198'???' # setpriority
199time # time
7e3cfbc1 200localtime $^T # localtime
201gmtime $^T # gmtime
317982ac 202sleep 1 # sleep
203'???' # alarm
204'???' # shmget
205'???' # shmctl
206'???' # shmread
207'???' # shmwrite
208'???' # msgget
209'???' # msgctl
210'???' # msgsnd
211'???' # msgrcv
212'???' # semget
213'???' # semctl
214'???' # semop
215'???' # getlogin
216'???' # syscall