64-bit work. Now 32-bit platforms get a 100% make test
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / pp_ctl
CommitLineData
599cee73 1 pp_ctl.c AOK
2
3 Not enough format arguments
4 format STDOUT =
5 @<<< @<<<
6 $a
7 .
8 write;
9
10
11 Exiting substitution via %s
12 $_ = "abc" ;
13 while ($i ++ == 0)
14 {
15 s/ab/last/e ;
16 }
17
18 Exiting subroutine via %s
19 sub fred { last }
20 { fred() }
21
22 Exiting eval via %s
23 { eval "last" }
24
25 Exiting pseudo-block via %s
26 @a = (1,2) ; @b = sort { last } @a ;
27
28 Exiting substitution via %s
29 $_ = "abc" ;
30 last fred:
31 while ($i ++ == 0)
32 {
33 s/ab/last fred/e ;
34 }
35
36
37 Exiting subroutine via %s
38 sub fred { last joe }
39 joe: { fred() }
40
41 Exiting eval via %s
42 fred: { eval "last fred" }
43
44 Exiting pseudo-block via %s
45 @a = (1,2) ; fred: @b = sort { last fred } @a ;
46
47
48 Deep recursion on subroutine \"%s\"
49 sub fred
50 {
51 goto &fred() if $a++ < 200
52 }
53
54 goto &fred()
55
a99e4ac2 56 (in cleanup) foo bar
57 package Foo;
58 DESTROY { die "foo bar" }
59 { bless [], 'Foo' for 1..10 }
599cee73 60
61__END__
62# pp_ctl.c
63use warning 'syntax' ;
64format STDOUT =
65@<<< @<<<
661
67.
68write;
69EXPECT
70Not enough format arguments at - line 5.
711
72########
73# pp_ctl.c
0453d815 74no warning 'syntax' ;
75format =
76@<<< @<<<
771
78.
79write ;
80EXPECT
811
82########
83# pp_ctl.c
599cee73 84use warning 'unsafe' ;
85$_ = "abc" ;
86
87while ($i ++ == 0)
88{
89 s/ab/last/e ;
90}
0453d815 91no warning 'unsafe' ;
92while ($i ++ == 0)
93{
94 s/ab/last/e ;
95}
599cee73 96EXPECT
97Exiting substitution via last at - line 7.
98########
99# pp_ctl.c
100use warning 'unsafe' ;
101sub fred { last }
102{ fred() }
0453d815 103no warning 'unsafe' ;
104sub joe { last }
105{ joe() }
599cee73 106EXPECT
107Exiting subroutine via last at - line 3.
108########
109# pp_ctl.c
0453d815 110{
111 eval "use warning 'unsafe' ; last;"
112}
113print STDERR $@ ;
114{
115 eval "no warning 'unsafe' ;last;"
116}
599cee73 117print STDERR $@ ;
118EXPECT
119Exiting eval via last at (eval 1) line 1.
120########
121# pp_ctl.c
122use warning 'unsafe' ;
123@a = (1,2) ;
124@b = sort { last } @a ;
0453d815 125no warning 'unsafe' ;
126@b = sort { last } @a ;
599cee73 127EXPECT
128Exiting pseudo-block via last at - line 4.
129Can't "last" outside a block at - line 4.
130########
131# pp_ctl.c
132use warning 'unsafe' ;
133$_ = "abc" ;
134fred:
135while ($i ++ == 0)
136{
137 s/ab/last fred/e ;
138}
0453d815 139no warning 'unsafe' ;
140while ($i ++ == 0)
141{
142 s/ab/last fred/e ;
143}
599cee73 144EXPECT
145Exiting substitution via last at - line 7.
146########
147# pp_ctl.c
148use warning 'unsafe' ;
149sub fred { last joe }
150joe: { fred() }
0453d815 151no warning 'unsafe' ;
152sub Fred { last Joe }
153Joe: { Fred() }
599cee73 154EXPECT
155Exiting subroutine via last at - line 3.
156########
157# pp_ctl.c
0453d815 158joe:
159{ eval "use warning 'unsafe' ; last joe;" }
160print STDERR $@ ;
161Joe:
162{ eval "no warning 'unsafe' ; last Joe;" }
599cee73 163print STDERR $@ ;
164EXPECT
60e6418e 165Exiting eval via last at (eval 1) line 1.
599cee73 166########
167# pp_ctl.c
168use warning 'unsafe' ;
169@a = (1,2) ;
170fred: @b = sort { last fred } @a ;
0453d815 171no warning 'unsafe' ;
172Fred: @b = sort { last Fred } @a ;
599cee73 173EXPECT
174Exiting pseudo-block via last at - line 4.
175Label not found for "last fred" at - line 4.
176########
177# pp_ctl.c
178use warning 'recursion' ;
179BEGIN { warn "PREFIX\n" ;}
180sub fred
181{
182 goto &fred() if $a++ < 200
183}
184
185goto &fred()
186EXPECT
187Deep recursion on subroutine "main::fred" at - line 6.
a99e4ac2 188########
189# pp_ctl.c
0453d815 190no warning 'recursion' ;
191BEGIN { warn "PREFIX\n" ;}
192sub fred
193{
194 goto &fred() if $a++ < 200
195}
196
197goto &fred()
198EXPECT
199Can't find label
200########
201# pp_ctl.c
a99e4ac2 202use warning 'unsafe' ;
203package Foo;
204DESTROY { die "@{$_[0]} foo bar" }
205{ bless ['A'], 'Foo' for 1..10 }
b5d92ff4 206{ bless ['B'], 'Foo' for 1..10 }
a99e4ac2 207EXPECT
208 (in cleanup) A foo bar at - line 4.
b5d92ff4 209 (in cleanup) B foo bar at - line 4.
0453d815 210########
211# pp_ctl.c
212no warning 'unsafe' ;
213package Foo;
214DESTROY { die "@{$_[0]} foo bar" }
215{ bless ['A'], 'Foo' for 1..10 }
216{ bless ['B'], 'Foo' for 1..10 }
217EXPECT
218