This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
applied suggested patch, modulo already applied parts
[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
06eaf0bc
GS
6 Missing command in piped open
7 open(F, "| ");
8
9 Missing command in piped open
10 open(F, " |");
11
599cee73
PM
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__END__
45# doio.c
46use warning 'io' ;
3eeba6fb
CB
47open(F, '|'.($^O eq 'VMS' ? 'mcr ':'')."$^X -e 1|");
48close(F);
599cee73
PM
49EXPECT
50Can't do bidirectional pipe at - line 3.
51########
52# doio.c
53use warning 'io' ;
06eaf0bc
GS
54open(F, "| ")
55EXPECT
56Missing command in piped open at - line 3.
57########
58# doio.c
59use warning 'io' ;
60open(F, " |")
61EXPECT
62Missing command in piped open at - line 3.
63########
64# doio.c
65use warning 'io' ;
599cee73
PM
66open(F, "<true\ncd")
67EXPECT
68Unsuccessful open on filename containing newline at - line 3.
69########
70# doio.c
71use warning 'io' ;
72close STDIN ;
73tell(STDIN);
74$a = seek(STDIN,1,1);
75$a = sysseek(STDIN,1,1);
76-x STDIN ;
77EXPECT
78tell() on unopened file at - line 4.
79seek() on unopened file at - line 5.
80sysseek() on unopened file at - line 6.
81Stat on unopened file <STDIN> at - line 7.
82########
83# doio.c
84use warning 'uninitialized' ;
85print $a ;
86EXPECT
87Use of uninitialized value at - line 3.
88########
89# doio.c
90use warning 'io' ;
91
92EXPECT
93
94########
95# doio.c
96use warning 'io' ;
97stat "ab\ncd";
98lstat "ab\ncd";
99EXPECT
100Unsuccessful stat on filename containing newline at - line 3.
101Unsuccessful stat on filename containing newline at - line 4.
102########
103# doio.c
104use warning 'io' ;
dfe13c55 105exec "lskdjfalksdjfdjfkls","" ;
599cee73 106EXPECT
e5e1b98b 107OPTION regex
c4f6c246 108Can't exec "lskdjfalksdjfdjfkls": .+
599cee73
PM
109########
110# doio.c
111use warning 'io' ;
112exec "lskdjfalksdjfdjfkls", "abc" ;
113EXPECT
e5e1b98b 114OPTION regex
3eeba6fb 115Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+