change#3612 is buggy when quotemeta argument matches target
[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 %s opened only for input
7     format STDIN =
8     .
9     write STDIN;
10
11   Write on closed filehandle %s
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 warnings 'untie' ;
82 sub TIESCALAR { bless [] } ; 
83 $b = tie $a, 'main'; 
84 untie $a ;
85 no warnings 'untie' ;
86 $c = tie $d, 'main'; 
87 untie $d ;
88 EXPECT
89 untie attempted while 1 inner references still exist at - line 5.
90 ########
91 # pp_sys.c
92 use warnings 'io' ;
93 format STDIN =
94 .
95 write STDIN;
96 no warnings 'io' ;
97 write STDIN;
98 EXPECT
99 Filehandle main::STDIN opened only for input at - line 5.
100 ########
101 # pp_sys.c
102 use warnings 'closed' ;
103 format STDIN =
104 .
105 close STDIN;
106 write STDIN;
107 no warnings 'closed' ;
108 write STDIN;
109 EXPECT
110 Write on closed filehandle main::STDIN at - line 6.
111 ########
112 # pp_sys.c
113 use warnings 'io' ;
114 format STDOUT_TOP =
115 abc
116 .
117 format STDOUT =
118 def
119 ghi
120 .
121 $= = 1 ;
122 $- =1 ;
123 open STDOUT, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
124 write ;
125 no warnings 'io' ;
126 write ;
127 EXPECT
128 page overflow at - line 13.
129 ########
130 # pp_sys.c
131 use warnings 'unopened' ;
132 $a = "abc"; 
133 printf $a "fred";
134 no warnings 'unopened' ;
135 printf $a "fred";
136 EXPECT
137 Filehandle main::abc never opened at - line 4.
138 ########
139 # pp_sys.c
140 use warnings 'closed' ;
141 close STDIN ;
142 printf STDIN "fred";
143 no warnings 'closed' ;
144 printf STDIN "fred";
145 EXPECT
146 printf on closed filehandle main::STDIN at - line 4.
147 ########
148 # pp_sys.c
149 use warnings 'io' ;
150 printf STDIN "fred";
151 no warnings 'io' ;
152 printf STDIN "fred";
153 EXPECT
154 Filehandle main::STDIN opened only for input at - line 3.
155 ########
156 # pp_sys.c
157 use warnings 'closed' ;
158 close STDIN; 
159 syswrite STDIN, "fred", 1;
160 no warnings 'closed' ;
161 syswrite STDIN, "fred", 1;
162 EXPECT
163 Syswrite on closed filehandle at - line 4.
164 ########
165 # pp_sys.c
166 use warnings 'io' ;
167 use Config; 
168 BEGIN { 
169   if ( $^O ne 'VMS' and ! $Config{d_socket}) {
170     print <<EOM ;
171 SKIPPED
172 # send not present
173 # bind not present
174 # connect not present
175 # accept not present
176 # shutdown not present
177 # setsockopt not present
178 # getsockopt not present
179 # getsockname not present
180 # getpeername not present
181 EOM
182     exit ;
183   } 
184 }
185 close STDIN; 
186 send STDIN, "fred", 1;
187 bind STDIN, "fred" ;
188 connect STDIN, "fred" ;
189 listen STDIN, 2;
190 accept STDIN, "fred" ;
191 shutdown STDIN, 0;
192 setsockopt STDIN, 1,2,3;
193 getsockopt STDIN, 1,2;
194 getsockname STDIN;
195 getpeername STDIN;
196 no warnings 'io' ;
197 send STDIN, "fred", 1;
198 bind STDIN, "fred" ;
199 connect STDIN, "fred" ;
200 listen STDIN, 2;
201 accept STDIN, "fred" ;
202 shutdown STDIN, 0;
203 setsockopt STDIN, 1,2,3;
204 getsockopt STDIN, 1,2;
205 getsockname STDIN;
206 getpeername STDIN;
207 EXPECT
208 Send on closed socket at - line 22.
209 bind() on closed fd at - line 23.
210 connect() on closed fd at - line 24.
211 listen() on closed fd at - line 25.
212 accept() on closed fd at - line 26.
213 shutdown() on closed fd at - line 27.
214 [gs]etsockopt() on closed fd at - line 28.
215 [gs]etsockopt() on closed fd at - line 29.
216 get{sock, peer}name() on closed fd at - line 30.
217 get{sock, peer}name() on closed fd at - line 31.
218 ########
219 # pp_sys.c
220 use warnings 'newline' ;
221 stat "abc\ndef";
222 no warnings 'newline' ;
223 stat "abc\ndef";
224 EXPECT
225 Unsuccessful stat on filename containing newline at - line 3.
226 ########
227 # pp_sys.c
228 use warnings 'unopened' ;
229 close STDIN ; 
230 -T STDIN ;
231 no warnings 'unopened' ;
232 -T STDIN ;
233 EXPECT
234 Test on unopened file <STDIN> at - line 4.
235 ########
236 # pp_sys.c
237 use warnings 'newline' ;
238 -T "abc\ndef" ;
239 no warnings 'newline' ;
240 -T "abc\ndef" ;
241 EXPECT
242 Unsuccessful open on filename containing newline at - line 3.