This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
lexical warnings; tweaks to places that didn't apply correctly
[perl5.git] / t / pragma / warn-doio
CommitLineData
599cee73
PM
1 doio.c AOK
2
3 Can't do bidirectional pipe
4 open(F, "| true |");
5
6 warn(warn_nl, "open");
7 open(F, "true\ncd")
8
9 Close on unopened file <%s>
10 $a = "fred";close($a)
11
12 tell() on unopened file
13 $a = "fred";$a = tell($a)
14
15 seek() on unopened file
16 $a = "fred";$a = seek($a,1,1)
17
18 sysseek() on unopened file
19 $a = "fred";$a = seek($a,1,1)
20
21 warn(warn_uninit);
22 print $a ;
23
24 Stat on unopened file <%s>
25 close STDIN ; -x STDIN ;
26
27 warn(warn_nl, "stat");
28 stat "ab\ncd"
29
30 warn(warn_nl, "lstat");
31 lstat "ab\ncd"
32
33 Can't exec \"%s\": %s
34
35 Can't exec \"%s\": %s
36
37
38__END__
39# doio.c
40use warning 'io' ;
41open(F, "|true|")
42EXPECT
43Can't do bidirectional pipe at - line 3.
44########
45# doio.c
46use warning 'io' ;
47open(F, "<true\ncd")
48EXPECT
49Unsuccessful open on filename containing newline at - line 3.
50########
51# doio.c
52use warning 'io' ;
53close STDIN ;
54tell(STDIN);
55$a = seek(STDIN,1,1);
56$a = sysseek(STDIN,1,1);
57-x STDIN ;
58EXPECT
59tell() on unopened file at - line 4.
60seek() on unopened file at - line 5.
61sysseek() on unopened file at - line 6.
62Stat on unopened file <STDIN> at - line 7.
63########
64# doio.c
65use warning 'uninitialized' ;
66print $a ;
67EXPECT
68Use of uninitialized value at - line 3.
69########
70# doio.c
71use warning 'io' ;
72
73EXPECT
74
75########
76# doio.c
77use warning 'io' ;
78stat "ab\ncd";
79lstat "ab\ncd";
80EXPECT
81Unsuccessful stat on filename containing newline at - line 3.
82Unsuccessful stat on filename containing newline at - line 4.
83########
84# doio.c
85use warning 'io' ;
86exec "lskdjfalksdjfdjfkls" ;
87EXPECT
88Can't exec "lskdjfalksdjfdjfkls": No such file or directory at - line 3.
89########
90# doio.c
91use warning 'io' ;
92exec "lskdjfalksdjfdjfkls", "abc" ;
93EXPECT
94Can't exec "lskdjfalksdjfdjfkls": No such file or directory at - line 3.