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