Skip to content

Commit

Permalink
builtin: test the unary functions see if tail call crashes them
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed Sep 10, 2024
1 parent f18202d commit 0c6a239
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/builtin.t
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,24 @@ use v5.39;
EOS
}

# github #22542
{
# some of these functions don't error at this point, but they might be updated
# and see the same problem we fix here
for my $func (qw(is_bool is_weak blessed refaddr reftype ceil floor is_tainted
trim stringify created_as_string created_as_number)) {
my $arg =
$func =~ /ceil|floor|created_as/ ? "1.1" :
$func =~ /(^ref|blessed|is_weak)/ ? "\\1" : '"abc"';
fresh_perl_is(<<"EOS", "ok", {}, "goto $func");
no warnings "experimental";
sub f { goto &builtin::$func }
f($arg);
print "ok";
EOS
}
}

# vim: tabstop=4 shiftwidth=4 expandtab autoindent softtabstop=4

done_testing();

0 comments on commit 0c6a239

Please sign in to comment.