rename t/pragma/warn-* to t/pragma/warn/*, be 8.3-friendly
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp_sys
1   pp_sys.c      AOK
2
3   untie attempted while %d inner references still exist
4     sub TIESCALAR { bless [] } ; tie $a, 'main'; untie $a ;
5
6   Filehandle only opened for input
7     format STDIN =
8     .
9     write STDIN;
10
11   Write on closed filehandle
12     format STDIN =
13     .
14     close STDIN;
15     write STDIN ;
16
17   page overflow 
18
19   Filehandle %s never opened
20     $a = "abc"; printf $a "fred"
21
22   Filehandle %s opened only for input
23     $a = "abc"; 
24     printf $a "fred"
25
26   printf on closed filehandle %s
27     close STDIN ;
28     printf STDIN "fred"
29
30   Syswrite on closed filehandle
31     close STDIN; 
32     syswrite STDIN, "fred", 1;
33
34   Send on closed socket
35     close STDIN; 
36     send STDIN, "fred", 1
37
38   bind() on closed fd
39     close STDIN; 
40     bind STDIN, "fred" ;
41
42
43   connect() on closed fd
44     close STDIN; 
45     connect STDIN, "fred" ;
46
47   listen() on closed fd
48     close STDIN; 
49     listen STDIN, 2;
50
51   accept() on closed fd
52     close STDIN; 
53     accept STDIN, "fred" ;
54
55   shutdown() on closed fd
56     close STDIN; 
57     shutdown STDIN, 0;
58
59   [gs]etsockopt() on closed fd
60     close STDIN; 
61     setsockopt STDIN, 1,2,3;
62     getsockopt STDIN, 1,2;
63
64   get{sock, peer}name() on closed fd
65     close STDIN; 
66     getsockname STDIN;
67     getpeername STDIN;
68
69   warn(warn_nl, "stat");
70
71   Test on unopened file <%s>
72         close STDIN ; -T STDIN ;
73
74   warn(warn_nl, "open");
75     -T "abc\ndef" ;
76
77   
78
79 __END__
80 # pp_sys.c
81 use warning 'untie' ;
82 sub TIESCALAR { bless [] } ; 
83 $b = tie $a, 'main'; 
84 untie $a ;
85 EXPECT
86 untie attempted while 1 inner references still exist at - line 5.
87 ########
88 # pp_sys.c
89 use warning 'io' ;
90 format STDIN =
91 .
92 write STDIN;
93 EXPECT
94 Filehandle only opened for input at - line 5.
95 ########
96 # pp_sys.c
97 use warning 'closed' ;
98 format STDIN =
99 .
100 close STDIN;
101 write STDIN;
102 EXPECT
103 Write on closed filehandle at - line 6.
104 ########
105 # pp_sys.c
106 use warning 'io' ;
107 format STDOUT_TOP =
108 abc
109 .
110 format STDOUT =
111 def
112 ghi
113 .
114 $= = 1 ;
115 $- =1 ;
116 open STDOUT, ">/dev/null" ;
117 write ;
118 EXPECT
119 page overflow at - line 13.
120 ########
121 # pp_sys.c
122 use warning 'unopened' ;
123 $a = "abc"; 
124 printf $a "fred"
125 EXPECT
126 Filehandle main::abc never opened at - line 4.
127 ########
128 # pp_sys.c
129 use warning 'closed' ;
130 close STDIN ;
131 printf STDIN "fred"
132 EXPECT
133 printf on closed filehandle main::STDIN at - line 4.
134 ########
135 # pp_sys.c
136 use warning 'io' ;
137 printf STDIN "fred"
138 EXPECT
139 Filehandle main::STDIN opened only for input at - line 3.
140 ########
141 # pp_sys.c
142 use warning 'closed' ;
143 close STDIN; 
144 syswrite STDIN, "fred", 1;
145 EXPECT
146 Syswrite on closed filehandle at - line 4.
147 ########
148 # pp_sys.c
149 use warning 'io' ;
150 use Config; 
151 BEGIN { 
152   if ( $^O ne 'VMS' and ! $Config{d_socket}) {
153     print <<EOM ;
154 SKIPPED
155 # send not present
156 # bind not present
157 # connect not present
158 # accept not present
159 # shutdown not present
160 # setsockopt not present
161 # getsockopt not present
162 # getsockname not present
163 # getpeername not present
164 EOM
165     exit ;
166   } 
167 }
168 close STDIN; 
169 send STDIN, "fred", 1;
170 bind STDIN, "fred" ;
171 connect STDIN, "fred" ;
172 listen STDIN, 2;
173 accept STDIN, "fred" ;
174 shutdown STDIN, 0;
175 setsockopt STDIN, 1,2,3;
176 getsockopt STDIN, 1,2;
177 getsockname STDIN;
178 getpeername STDIN;
179 EXPECT
180 Send on closed socket at - line 22.
181 bind() on closed fd at - line 23.
182 connect() on closed fd at - line 24.
183 listen() on closed fd at - line 25.
184 accept() on closed fd at - line 26.
185 shutdown() on closed fd at - line 27.
186 [gs]etsockopt() on closed fd at - line 28.
187 [gs]etsockopt() on closed fd at - line 29.
188 get{sock, peer}name() on closed fd at - line 30.
189 get{sock, peer}name() on closed fd at - line 31.
190 ########
191 # pp_sys.c
192 use warning 'newline' ;
193 stat "abc\ndef";
194 EXPECT
195 Unsuccessful stat on filename containing newline at - line 3.
196 ########
197 # pp_sys.c
198 use warning 'unopened' ;
199 close STDIN ; 
200 -T STDIN ;
201 EXPECT
202 Test on unopened file <STDIN> at - line 4.
203 ########
204 # pp_sys.c
205 use warning 'newline' ;
206 -T "abc\ndef" ;
207 EXPECT
208 Unsuccessful open on filename containing newline at - line 3.