Skip to content

Commit 7cdc183

Browse files
1-1samkhwilliamson
authored andcommitted
todo test for GH 20491 (defer inside do block is broken)
This commit adds a todo test for GH 20491. It tests that a defer block in a single-expression do block runs when exiting said do block, instead of the block holding the do block.
1 parent 2328936 commit 7cdc183

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

t/run/todo.t

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ TODO: {
351351
isnt($?, 0, 'Compilation fails; GH 19378');
352352
}
353353

354+
TODO: {
355+
local $::TODO = 'GH 20491';
356+
use experimental 'defer';
357+
my $deferred = 0;
358+
do {
359+
defer { $deferred = 1 };
360+
};
361+
is($deferred, 1, 'defer in single-expression do block runs when exiting block; GH 20491');
362+
}
363+
354364
TODO: {
355365
todo_skip 1 if is_miniperl();
356366
local $::TODO = 'GH 22168';

0 commit comments

Comments
 (0)