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