Rename warning to warnings, from Paul Marquess.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / doio
1   doio.c        AOK
2
3   Can't do bidirectional pipe
4     open(F, "| true |");
5
6   Missing command in piped open
7     open(F, "| ");
8
9   Missing command in piped open
10     open(F, " |");
11
12   warn(warn_nl, "open");
13     open(F, "true\ncd")
14
15   Close on unopened file <%s>
16     $a = "fred";close($a)
17
18   tell() on unopened file
19     $a = "fred";$a = tell($a)
20
21   seek() on unopened file
22     $a = "fred";$a = seek($a,1,1)
23
24   sysseek() on unopened file
25     $a = "fred";$a = seek($a,1,1)
26
27   warn(warn_uninit);
28     print $a ;
29
30   Stat on unopened file <%s> 
31     close STDIN ; -x STDIN ;
32
33   warn(warn_nl, "stat");
34     stat "ab\ncd"
35
36   warn(warn_nl, "lstat");
37     lstat "ab\ncd"
38
39   Can't exec \"%s\": %s 
40
41   Can't exec \"%s\": %s 
42
43
44   Mandatory Warnings ALL TODO
45   ------------------
46   Can't do inplace edit: %s is not a regular file
47      edit a directory
48
49   Can't do inplace edit: %s would not be unique
50   Can't rename %s to %s: %s, skipping file
51   Can't rename %s to %s: %s, skipping file
52   Can't remove %s: %s, skipping file
53   Can't do inplace edit on %s: %s
54   
55
56 __END__
57 # doio.c
58 use warnings 'io' ;
59 open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
60 close(F);
61 no warnings 'io' ;
62 open(G, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
63 close(G);
64 EXPECT
65 Can't do bidirectional pipe at - line 3.
66 ########
67 # doio.c
68 use warnings 'io' ;
69 open(F, "|      ");
70 no warnings 'io' ;
71 open(G, "|      ");
72 EXPECT
73 Missing command in piped open at - line 3.
74 ########
75 # doio.c
76 use warnings 'io' ;
77 open(F, "      |");
78 no warnings 'io' ;
79 open(G, "      |");
80 EXPECT
81 Missing command in piped open at - line 3.
82 ########
83 # doio.c
84 use warnings 'io' ;
85 open(F, "<true\ncd");
86 no warnings 'io' ;
87 open(G, "<true\ncd");
88 EXPECT
89 Unsuccessful open on filename containing newline at - line 3.
90 ########
91 # doio.c
92 use warnings 'io' ;
93 close STDIN ;
94 tell(STDIN);
95 $a = seek(STDIN,1,1);
96 $a = sysseek(STDIN,1,1);
97 -x STDIN ;
98 no warnings 'io' ;
99 close STDIN ;
100 tell(STDIN);
101 $a = seek(STDIN,1,1);
102 $a = sysseek(STDIN,1,1);
103 -x STDIN ;
104 EXPECT
105 tell() on unopened file at - line 4.
106 seek() on unopened file at - line 5.
107 sysseek() on unopened file at - line 6.
108 Stat on unopened file <STDIN> at - line 7.
109 ########
110 # doio.c
111 use warnings 'uninitialized' ;
112 print $a ;
113 no warnings 'uninitialized' ;
114 print $b ;
115 EXPECT
116 Use of uninitialized value at - line 3.
117 ########
118 # doio.c
119 use warnings 'io' ;
120
121 EXPECT
122
123 ########
124 # doio.c
125 use warnings 'io' ;
126 stat "ab\ncd";
127 lstat "ab\ncd";
128 no warnings 'io' ;
129 stat "ab\ncd";
130 lstat "ab\ncd";
131 EXPECT
132 Unsuccessful stat on filename containing newline at - line 3.
133 Unsuccessful stat on filename containing newline at - line 4.
134 ########
135 # doio.c
136 use warnings 'io' ;
137 exec "lskdjfalksdjfdjfkls","" ;
138 no warnings 'io' ;
139 exec "lskdjfalksdjfdjfkls","" ;
140 EXPECT
141 OPTION regex
142 Can't exec "lskdjfalksdjfdjfkls": .+
143 ########
144 # doio.c
145 use warnings 'io' ;
146 exec "lskdjfalksdjfdjfkls", "abc" ;
147 no warnings 'io' ;
148 exec "lskdjfalksdjfdjfkls", "abc" ;
149 EXPECT
150 OPTION regex
151 Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
152 ########
153 # doio.c
154 $^W = 0 ;
155 my $filename = "./temp" ;
156 mkdir $filename, 0777 
157   or die "Cannot create directory $filename: $!\n" ;
158 {
159     local (@ARGV) = ($filename) ;
160     local ($^I) = "" ;
161     my $x = <> ;
162 }
163 {
164     no warnings 'inplace' ;
165     local (@ARGV) = ($filename) ;
166     local ($^I) = "" ;
167     my $x = <> ;
168 }
169 {
170     use warnings 'inplace' ;
171     local (@ARGV) = ($filename) ;
172     local ($^I) = "" ;
173     my $x = <> ;
174 }
175 rmdir $filename ;
176 EXPECT
177 Can't do inplace edit: ./temp is not a regular file at - line 9.
178 Can't do inplace edit: ./temp is not a regular file at - line 21.
179