Skip to content

Commit

Permalink
Tests and bugfixes for on_die with multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyink committed Sep 11, 2022
1 parent a618922 commit e13bb7a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Type/Params.pm
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ sub multisig {
{
my ( $extra_env, @extra_lines ) = ( {}, 'my $on_die = undef;' );
if ( $options{'on_die'} ) {
my ( $extra_env, @extra_lines ) = ( { '$on_die' => \$options{'on_die'} }, '1;' );
( $extra_env, @extra_lines ) = ( { '$on_die' => \$options{'on_die'} }, '1;' );
}
if ( @extra_lines ) {
$code[0] .= join '', @extra_lines;
Expand Down
16 changes: 16 additions & 0 deletions t/20-modules/Type-Params/multisig.t
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,20 @@ is exception {
$check->( b => 3 );
}, undef;

{
my $error;
my $other = multisig(
{ on_die => sub { $error = shift->message; () } },
[ Int, ArrayRef[$Rounded] ],
[ ArrayRef[$Rounded], Int ],
[ HashRef[Num] ],
);
$other->();
is(
$error,
'Parameter validation failed',
'on_die works',
);
}

done_testing;

0 comments on commit e13bb7a

Please sign in to comment.