Rename warning to warnings, from Paul Marquess.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / doio
CommitLineData
599cee73 1 doio.c AOK
2
3 Can't do bidirectional pipe
4 open(F, "| true |");
5
06eaf0bc 6 Missing command in piped open
7 open(F, "| ");
8
9 Missing command in piped open
10 open(F, " |");
11
599cee73 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
0453d815 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
599cee73 56__END__
57# doio.c
4438c4b7 58use warnings 'io' ;
3eeba6fb 59open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
60close(F);
4438c4b7 61no warnings 'io' ;
0453d815 62open(G, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
63close(G);
599cee73 64EXPECT
65Can't do bidirectional pipe at - line 3.
66########
67# doio.c
4438c4b7 68use warnings 'io' ;
0453d815 69open(F, "| ");
4438c4b7 70no warnings 'io' ;
0453d815 71open(G, "| ");
06eaf0bc 72EXPECT
73Missing command in piped open at - line 3.
74########
75# doio.c
4438c4b7 76use warnings 'io' ;
0453d815 77open(F, " |");
4438c4b7 78no warnings 'io' ;
0453d815 79open(G, " |");
06eaf0bc 80EXPECT
81Missing command in piped open at - line 3.
82########
83# doio.c
4438c4b7 84use warnings 'io' ;
0453d815 85open(F, "<true\ncd");
4438c4b7 86no warnings 'io' ;
0453d815 87open(G, "<true\ncd");
599cee73 88EXPECT
89Unsuccessful open on filename containing newline at - line 3.
90########
91# doio.c
4438c4b7 92use warnings 'io' ;
599cee73 93close STDIN ;
94tell(STDIN);
95$a = seek(STDIN,1,1);
96$a = sysseek(STDIN,1,1);
97-x STDIN ;
4438c4b7 98no warnings 'io' ;
0453d815 99close STDIN ;
100tell(STDIN);
101$a = seek(STDIN,1,1);
102$a = sysseek(STDIN,1,1);
103-x STDIN ;
599cee73 104EXPECT
105tell() on unopened file at - line 4.
106seek() on unopened file at - line 5.
107sysseek() on unopened file at - line 6.
108Stat on unopened file <STDIN> at - line 7.
109########
110# doio.c
4438c4b7 111use warnings 'uninitialized' ;
599cee73 112print $a ;
4438c4b7 113no warnings 'uninitialized' ;
0453d815 114print $b ;
599cee73 115EXPECT
116Use of uninitialized value at - line 3.
117########
118# doio.c
4438c4b7 119use warnings 'io' ;
599cee73 120
121EXPECT
122
123########
124# doio.c
4438c4b7 125use warnings 'io' ;
599cee73 126stat "ab\ncd";
127lstat "ab\ncd";
4438c4b7 128no warnings 'io' ;
0453d815 129stat "ab\ncd";
130lstat "ab\ncd";
599cee73 131EXPECT
132Unsuccessful stat on filename containing newline at - line 3.
133Unsuccessful stat on filename containing newline at - line 4.
134########
135# doio.c
4438c4b7 136use warnings 'io' ;
dfe13c55 137exec "lskdjfalksdjfdjfkls","" ;
4438c4b7 138no warnings 'io' ;
0453d815 139exec "lskdjfalksdjfdjfkls","" ;
599cee73 140EXPECT
e5e1b98b 141OPTION regex
c4f6c246 142Can't exec "lskdjfalksdjfdjfkls": .+
599cee73 143########
144# doio.c
4438c4b7 145use warnings 'io' ;
599cee73 146exec "lskdjfalksdjfdjfkls", "abc" ;
4438c4b7 147no warnings 'io' ;
0453d815 148exec "lskdjfalksdjfdjfkls", "abc" ;
599cee73 149EXPECT
e5e1b98b 150OPTION regex
3eeba6fb 151Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
0453d815 152########
153# doio.c
154$^W = 0 ;
155my $filename = "./temp" ;
156mkdir $filename, 0777
157 or die "Cannot create directory $filename: $!\n" ;
158{
159 local (@ARGV) = ($filename) ;
160 local ($^I) = "" ;
161 my $x = <> ;
162}
163{
4438c4b7 164 no warnings 'inplace' ;
0453d815 165 local (@ARGV) = ($filename) ;
166 local ($^I) = "" ;
167 my $x = <> ;
168}
169{
4438c4b7 170 use warnings 'inplace' ;
0453d815 171 local (@ARGV) = ($filename) ;
172 local ($^I) = "" ;
173 my $x = <> ;
174}
175rmdir $filename ;
176EXPECT
177Can't do inplace edit: ./temp is not a regular file at - line 9.
178Can't do inplace edit: ./temp is not a regular file at - line 21.
179