Allow also non-long long but still quad platforms print quads.
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp_hot
CommitLineData
599cee73 1 pp_hot.c AOK
2
3 Filehandle %s never opened
4 $f = $a = "abc" ; print $f $a
5
6 Filehandle %s opened only for input
7 print STDIN "abc" ;
8
af8c498a 9 Filehandle %s opened only for output
10 print <STDOUT> ;
599cee73 11
12 print on closed filehandle %s
13 close STDIN ; print STDIN "abc" ;
14
15 uninitialized
16 my $a = undef ; my @b = @$a
17
18 uninitialized
19 my $a = undef ; my %b = %$a
20
21 Odd number of elements in hash list
22 %X = (1,2,3) ;
23
24 Reference found where even-sized list expected
25 $X = [ 1 ..3 ];
26
af8c498a 27 Read on closed filehandle %s
599cee73 28 close STDIN ; $a = <STDIN>;
29
30 Deep recursion on subroutine \"%s\"
31 sub fred { fred() if $a++ < 200} fred()
32
33 Deep recursion on anonymous subroutine
34 $a = sub { &$a if $a++ < 200} &$a
35
36__END__
37# pp_hot.c
38use warning 'unopened' ;
39$f = $a = "abc" ;
0453d815 40print $f $a;
41no warning 'unopened' ;
42print $f $a;
599cee73 43EXPECT
44Filehandle main::abc never opened at - line 4.
45########
46# pp_hot.c
47use warning 'io' ;
48print STDIN "anc";
af8c498a 49print <STDOUT>;
50print <STDERR>;
51open(FOO, ">&STDOUT") and print <FOO>;
52print getc(STDERR);
53print getc(FOO);
54read(FOO,$_,1);
0453d815 55no warning 'io' ;
56print STDIN "anc";
2135512e 57###############################################################
58# N O T E #
59# This test is known to fail on Linux systems with glibc. #
60# The glibc development team is aware of the problem, and has #
61# determined a fix for the next release of that library. #
62###############################################################
599cee73 63EXPECT
64Filehandle main::STDIN opened only for input at - line 3.
af8c498a 65Filehandle main::STDOUT opened only for output at - line 4.
66Filehandle main::STDERR opened only for output at - line 5.
67Filehandle main::FOO opened only for output at - line 6.
68Filehandle main::STDERR opened only for output at - line 7.
69Filehandle main::FOO opened only for output at - line 8.
70Filehandle main::FOO opened only for output at - line 9.
599cee73 71########
72# pp_hot.c
73use warning 'closed' ;
74close STDIN ;
75print STDIN "anc";
0453d815 76no warning 'closed' ;
77print STDIN "anc";
599cee73 78EXPECT
79print on closed filehandle main::STDIN at - line 4.
80########
81# pp_hot.c
82use warning 'uninitialized' ;
83my $a = undef ;
0453d815 84my @b = @$a;
85no warning 'uninitialized' ;
86my @c = @$a;
599cee73 87EXPECT
88Use of uninitialized value at - line 4.
89########
90# pp_hot.c
91use warning 'uninitialized' ;
92my $a = undef ;
0453d815 93my %b = %$a;
94no warning 'uninitialized' ;
95my %c = %$a;
599cee73 96EXPECT
97Use of uninitialized value at - line 4.
98########
99# pp_hot.c
100use warning 'unsafe' ;
101my %X ; %X = (1,2,3) ;
0453d815 102no warning 'unsafe' ;
103my %Y ; %Y = (1,2,3) ;
599cee73 104EXPECT
105Odd number of elements in hash assignment at - line 3.
106########
107# pp_hot.c
108use warning 'unsafe' ;
109my %X ; %X = [1 .. 3] ;
0453d815 110no warning 'unsafe' ;
111my %Y ; %Y = [1 .. 3] ;
599cee73 112EXPECT
113Reference found where even-sized list expected at - line 3.
114########
115# pp_hot.c
116use warning 'closed' ;
117close STDIN ; $a = <STDIN> ;
0453d815 118no warning 'closed' ;
119$a = <STDIN> ;
599cee73 120EXPECT
af8c498a 121Read on closed filehandle main::STDIN at - line 3.
599cee73 122########
123# pp_hot.c
124use warning 'recursion' ;
125sub fred
126{
127 fred() if $a++ < 200
128}
4a925ff6 129{
130 local $SIG{__WARN__} = sub {
131 die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/
132 };
133 fred();
134}
599cee73 135EXPECT
4a925ff6 136ok
599cee73 137########
138# pp_hot.c
0453d815 139no warning 'recursion' ;
140sub fred
141{
142 fred() if $a++ < 200
143}
144{
145 local $SIG{__WARN__} = sub {
146 die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/
147 };
148 fred();
149}
150EXPECT
151
152########
153# pp_hot.c
599cee73 154use warning 'recursion' ;
155$b = sub
156{
157 &$b if $a++ < 200
158} ;
159
160&$b ;
161EXPECT
162Deep recursion on anonymous subroutine at - line 5.
0453d815 163########
164# pp_hot.c
165no warning 'recursion' ;
166$b = sub
167{
168 &$b if $a++ < 200
169} ;
170
171&$b ;
172EXPECT
173