Skip to content

Commit c074558

Browse files
committed
Add test for returning from Supply quit handler.
1 parent e0bc46d commit c074558

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

S17-supply/return-in-tap.t

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use Test;
2+
plan 1;
3+
4+
sub dying($in) {
5+
supply {
6+
whenever $in {
7+
die "oh no";
8+
}
9+
}
10+
}
11+
12+
my $caught = 0;
13+
14+
sub try-it() {
15+
my $fake-in = Supplier.new;
16+
dying($fake-in.Supply).tap:
17+
quit => -> $exception {
18+
$caught++;
19+
return;
20+
};
21+
$fake-in.emit("XXX");
22+
}
23+
24+
for ^200 {
25+
try-it;
26+
}
27+
28+
is $caught, 200, 'return in a Supply quit handler works fine';

0 commit comments

Comments
 (0)