Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test for auto(un)boxing
  • Loading branch information
moritz committed Oct 25, 2011
1 parent fc81518 commit 1429c23
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S02-types/native.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 15;
plan 17;

{
my int $x;
Expand Down Expand Up @@ -48,4 +48,17 @@ plan 15;
is $str ~ $Str, '78', 'can concatenate native and boxed strings';
}

{
# these tests are a bit pointless, since is() already shows that boxing
# works. Still doesn't hurt to test it with explicit type constraints
sub g(Int $x) { $x * 2 }
my int $i = 21;
is g($i), 42, 'routine-entry int autoboxing';

sub h(int $x) { $x div 2 }
my Int $I = 84;
#?rakudo skip 'Cannot unbox argument to $x'
is h($I), 42, 'routine-entry Int autounboxing';
}

# vim: ft=perl6

0 comments on commit 1429c23

Please sign in to comment.