This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handle bracket stack better in recdescent parsing
[perl5.git] / ext / XS-APItest / t / looprest.t
CommitLineData
07ffcb73
Z
1use warnings;
2use strict;
3
a7aaec61 4use Test::More tests => 14;
07ffcb73
Z
5
6BEGIN { $^H |= 0x20000; }
7
8my $t;
9
10$t = "";
11eval 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};
22is $@, "";
23is $t, "abcbcbd";
24
25$t = "";
26eval 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};
34is $@, "";
35is $t, "abcbcb";
36
37$t = "";
38eval 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];
47isnt $@, "";
48is $t, "";
49
50$t = "";
51eval 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];
60isnt $@, "";
61is $t, "";
62
63$t = "";
64eval 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};
84is $@, "";
85is $t, "aabbccdbca";
86
a7aaec61
Z
87$t = "";
88eval 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};
99is $@, "";
100is $t, "abcbcbd";
101
102$t = "";
103eval 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};
111is $@, "";
112is $t, "abcbcb";
113
07ffcb73 1141;