Skip to content

Commit

Permalink
Add test for recursive spesh plugin setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 8, 2018
1 parent d94745f commit f8766f3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion t/moar/52-pluggable-spesh.t
Expand Up @@ -3,7 +3,7 @@
# Tests for extending the MoarVM specializer to guard on new kinds of things
# from NQP.

plan(52);
plan(53);

{
# Minimal test case: under no threaded contention, should run the resolve just
Expand Down Expand Up @@ -263,3 +263,17 @@ plan(52);
ok($msg eq 'Must have a type object', 'Correct result when we trigger type object deopt');
ok($times-run == 1, 'Ran the plugin another time if we had to deopt due to type object guard failure');
}

# Recursive spesh plugin setup
{
nqp::speshreg('nqp', 'rec-a', -> $code {
$code()
});
nqp::speshreg('nqp', 'rec-b', -> {
42
});
my $outcome := nqp::speshresolve('rec-a', -> {
nqp::speshresolve('rec-b')
});
ok($outcome == 42, 'Recursive speshresolve calls work out');
}

0 comments on commit f8766f3

Please sign in to comment.