File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# continuations.
4
4
5
- plan (19 );
5
+ plan (24 );
6
6
7
7
{
8
8
# unique objects
@@ -130,6 +130,31 @@ plan(19);
130
130
ok ($ B_in_invoke == 20 , ' invoke also sees the invocation context' );
131
131
}
132
132
133
+ {
134
+ my $ log := ' ' ;
135
+
136
+ my $ next ;
137
+ nqp ::continuationreset(nqp ::null(), {
138
+ $ log := $ log ~ 1 ;
139
+ nqp ::continuationcontrol(0 , nqp ::null(), -> $ cont { $ next := $ cont });
140
+ $ log := $ log ~ 2 ;
141
+ nqp ::continuationcontrol(0 , nqp ::null(), -> $ cont { $ next := $ cont });
142
+ $ log := $ log ~ 3 ;
143
+ nqp ::continuationcontrol(0 , nqp ::null(), -> $ cont { $ next := $ cont });
144
+ $ log := $ log ~ 4 ;
145
+ 777 ;
146
+ });
147
+
148
+ is ($ log , ' 1' , ' passing a continuation to nqp::continuationreset 1/4' );
149
+ nqp ::continuationreset(nqp ::null(), $ next );
150
+ is ($ log , ' 12' , ' passing a continuation to nqp::continuationreset 2/4' );
151
+ nqp ::continuationreset(nqp ::null(), $ next );
152
+ is ($ log , ' 123' , ' passing a continuation to nqp::continuationreset 3/4' );
153
+ my $ ret := nqp ::continuationreset(nqp ::null(), $ next );
154
+ is ($ log , ' 1234' , ' passing a continuation to nqp::continuationreset 4/4' );
155
+ is ($ ret , 777 , ' passing a continuation to nqp::continuationreset - correct return value' );
156
+ }
157
+
133
158
# gather/take example
134
159
{
135
160
my $ SENTINEL := [];
You can’t perform that action at this time.
0 commit comments