Commit | Line | Data |
---|---|---|
07ffcb73 Z |
1 | use warnings; |
2 | use strict; | |
3 | ||
a7aaec61 | 4 | use Test::More tests => 14; |
07ffcb73 Z |
5 | |
6 | BEGIN { $^H |= 0x20000; } | |
7 | ||
8 | my $t; | |
9 | ||
10 | $t = ""; | |
11 | eval q{ | |
12 | use XS::APItest qw(looprest); | |
13 | do { | |
14 | $t .= "a"; | |
15 | looprest | |
16 | $t .= "b"; | |
17 | last unless length($t) < 5; | |
18 | $t .= "c"; | |
19 | }; | |
20 | $t .= "d"; | |
21 | }; | |
22 | is $@, ""; | |
23 | is $t, "abcbcbd"; | |
24 | ||
25 | $t = ""; | |
26 | eval q{ | |
27 | use XS::APItest qw(looprest); | |
28 | $t .= "a"; | |
29 | looprest | |
30 | $t .= "b"; | |
31 | last unless length($t) < 5; | |
32 | $t .= "c"; | |
33 | }; | |
34 | is $@, ""; | |
35 | is $t, "abcbcb"; | |
36 | ||
37 | $t = ""; | |
38 | eval q[ | |
39 | use XS::APItest qw(looprest); | |
40 | do { | |
41 | $t .= "a"; | |
42 | looprest | |
43 | $t .= "b"; | |
44 | last unless length($t) < 5; | |
45 | $t .= "c"; | |
46 | ]; | |
47 | isnt $@, ""; | |
48 | is $t, ""; | |
49 | ||
50 | $t = ""; | |
51 | eval q[ | |
52 | use XS::APItest qw(looprest); | |
53 | $t .= "a"; | |
54 | looprest | |
55 | $t .= "b"; | |
56 | last unless length($t) < 5; | |
57 | $t .= "c"; | |
58 | }; | |
59 | ]; | |
60 | isnt $@, ""; | |
61 | is $t, ""; | |
62 | ||
63 | $t = ""; | |
64 | eval q{ | |
65 | use XS::APItest qw(looprest); | |
66 | my $x = "a"; | |
67 | $t .= $x; | |
68 | do { | |
69 | no warnings "misc"; | |
70 | $t .= $x; | |
71 | my $x = "b"; | |
72 | $t .= $x; | |
73 | looprest | |
74 | $t .= $x; | |
75 | my $x = "c"; | |
76 | $t .= $x; | |
77 | last unless length($t) < 7; | |
78 | $t .= $x; | |
79 | my $x = "d"; | |
80 | $t .= $x; | |
81 | }; | |
82 | $t .= $x; | |
83 | }; | |
84 | is $@, ""; | |
85 | is $t, "aabbccdbca"; | |
86 | ||
a7aaec61 Z |
87 | $t = ""; |
88 | eval q{ | |
89 | use XS::APItest qw(looprest); | |
90 | do { | |
91 | { $t .= "a"; } | |
92 | looprest | |
93 | { $t .= "b"; } | |
94 | last unless length($t) < 5; | |
95 | { $t .= "c"; } | |
96 | }; | |
97 | $t .= "d"; | |
98 | }; | |
99 | is $@, ""; | |
100 | is $t, "abcbcbd"; | |
101 | ||
102 | $t = ""; | |
103 | eval q{ | |
104 | use XS::APItest qw(looprest); | |
105 | { $t .= "a"; } | |
106 | looprest | |
107 | { $t .= "b"; } | |
108 | last unless length($t) < 5; | |
109 | { $t .= "c"; } | |
110 | }; | |
111 | is $@, ""; | |
112 | is $t, "abcbcb"; | |
113 | ||
07ffcb73 | 114 | 1; |