Suppress a few compilation warnings in pp_hot.c.
[p5sagit/p5-mst-13.2.git] / t / op / defins.t
CommitLineData
55d729e4 1#!./perl -w
2
3#
4# test auto defined() test insertion
5#
6
7BEGIN {
8 chdir 't' if -d 't';
20822f61 9 @INC = '../lib';
55d729e4 10 $SIG{__WARN__} = sub { $warns++; warn $_[0] };
11 print "1..14\n";
12}
b2b3adea 13
14$wanted_filename = $^O eq 'VMS' ? '0.' : '0';
95e8664e 15$saved_filename = $^O eq 'MacOS' ? ':0' : './0';
55d729e4 16
17print "not " if $warns;
18print "ok 1\n";
19
95e8664e 20open(FILE,">$saved_filename");
55d729e4 21print FILE "1\n";
22print FILE "0";
23close(FILE);
24
95e8664e 25open(FILE,"<$saved_filename");
55d729e4 26my $seen = 0;
27my $dummy;
28while (my $name = <FILE>)
29 {
30 $seen++ if $name eq '0';
31 }
32print "not " unless $seen;
33print "ok 2\n";
34
35seek(FILE,0,0);
36$seen = 0;
37my $line = '';
38do
39 {
40 $seen++ if $line eq '0';
41 } while ($line = <FILE>);
42
43print "not " unless $seen;
44print "ok 3\n";
45
46
47seek(FILE,0,0);
48$seen = 0;
49while (($seen ? $dummy : $name) = <FILE>)
50 {
51 $seen++ if $name eq '0';
52 }
53print "not " unless $seen;
54print "ok 4\n";
55
56seek(FILE,0,0);
57$seen = 0;
58my %where;
59while ($where{$seen} = <FILE>)
60 {
61 $seen++ if $where{$seen} eq '0';
62 }
63print "not " unless $seen;
64print "ok 5\n";
7120fed6 65close FILE;
55d729e4 66
95e8664e 67opendir(DIR,($^O eq 'MacOS' ? ':' : '.'));
55d729e4 68$seen = 0;
69while (my $name = readdir(DIR))
70 {
b2b3adea 71 $seen++ if $name eq $wanted_filename;
55d729e4 72 }
73print "not " unless $seen;
74print "ok 6\n";
75
76rewinddir(DIR);
77$seen = 0;
78$dummy = '';
79while (($seen ? $dummy : $name) = readdir(DIR))
80 {
b2b3adea 81 $seen++ if $name eq $wanted_filename;
55d729e4 82 }
83print "not " unless $seen;
84print "ok 7\n";
85
86rewinddir(DIR);
87$seen = 0;
88while ($where{$seen} = readdir(DIR))
89 {
b2b3adea 90 $seen++ if $where{$seen} eq $wanted_filename;
55d729e4 91 }
92print "not " unless $seen;
93print "ok 8\n";
94
95$seen = 0;
96while (my $name = glob('*'))
97 {
b2b3adea 98 $seen++ if $name eq $wanted_filename;
55d729e4 99 }
100print "not " unless $seen;
101print "ok 9\n";
102
103$seen = 0;
104$dummy = '';
105while (($seen ? $dummy : $name) = glob('*'))
106 {
b2b3adea 107 $seen++ if $name eq $wanted_filename;
55d729e4 108 }
109print "not " unless $seen;
110print "ok 10\n";
111
112$seen = 0;
113while ($where{$seen} = glob('*'))
114 {
b2b3adea 115 $seen++ if $where{$seen} eq $wanted_filename;
55d729e4 116 }
117print "not " unless $seen;
118print "ok 11\n";
119
95e8664e 120unlink($saved_filename);
55d729e4 121
122my %hash = (0 => 1, 1 => 2);
123
124$seen = 0;
125while (my $name = each %hash)
126 {
127 $seen++ if $name eq '0';
128 }
129print "not " unless $seen;
130print "ok 12\n";
131
132$seen = 0;
133$dummy = '';
134while (($seen ? $dummy : $name) = each %hash)
135 {
136 $seen++ if $name eq '0';
137 }
138print "not " unless $seen;
139print "ok 13\n";
140
141$seen = 0;
142while ($where{$seen} = each %hash)
143 {
144 $seen++ if $where{$seen} eq '0';
145 }
146print "not " unless $seen;
147print "ok 14\n";
148