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
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
40 use warning 'io' ;
41 open(F, "|true|")
42 EXPECT
43 Can't do bidirectional pipe at - line 3.
44 ########
45 # doio.c
46 use warning 'io' ;
47 open(F, "<true\ncd")
48 EXPECT
49 Unsuccessful open on filename containing newline at - line 3.
50 ########
51 # doio.c
52 use warning 'io' ;
53 close STDIN ;
54 tell(STDIN);
55 $a = seek(STDIN,1,1);
56 $a = sysseek(STDIN,1,1);
57 -x STDIN ;
58 EXPECT
59 tell() on unopened file at - line 4.
60 seek() on unopened file at - line 5.
61 sysseek() on unopened file at - line 6.
62 Stat on unopened file <STDIN> at - line 7.
63 ########
64 # doio.c
65 use warning 'uninitialized' ;
66 print $a ;
67 EXPECT
68 Use of uninitialized value at - line 3.
69 ########
70 # doio.c
71 use warning 'io' ;
72
73 EXPECT
74
75 ########
76 # doio.c
77 use warning 'io' ;
78 stat "ab\ncd";
79 lstat "ab\ncd";
80 EXPECT
81 Unsuccessful stat on filename containing newline at - line 3.
82 Unsuccessful stat on filename containing newline at - line 4.
83 ########
84 # doio.c
85 use warning 'io' ;
86 exec "lskdjfalksdjfdjfkls" ;
87 EXPECT
88 Can't exec "lskdjfalksdjfdjfkls": No such file or directory at - line 3.
89 ########
90 # doio.c
91 use warning 'io' ;
92 exec "lskdjfalksdjfdjfkls", "abc" ;
93 EXPECT
94 Can't exec "lskdjfalksdjfdjfkls": No such file or directory at - line 3.