Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
RT #79642, optional-but-not-bound hash is just a normal, empty Hash
  • Loading branch information
moritz committed Apr 22, 2012
1 parent a677cbb commit 2f2567f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion S06-signature/optional.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S06/Optional parameters/>

plan 24;
plan 25;

sub opt1($p?) { defined($p) ?? $p !! 'undef'; }

Expand Down Expand Up @@ -105,6 +105,12 @@ eval_dies_ok 'sub opt($a = 1, $b) { }',
%h
}
is opt-hash().keys, 'a', 'can assign to optional parameter';

# RT #79642
sub opt-hash2(%h?) {
%h;
}
ok opt-hash2() eqv ().hash, 'an optional-but-not-filled hash is just an empty Hash';
}

# vim: ft=perl6

0 comments on commit 2f2567f

Please sign in to comment.