Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tests for int/Int->num and num/Num->int args.
Should constrain; in Moar they accidentally coerced. And it seems we
had no test coverage for that.
  • Loading branch information
jnthn committed Sep 23, 2015
1 parent 5015ba2 commit a1c7756
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion S02-types/native.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 48;
plan 52;

{
my int $x;
Expand Down Expand Up @@ -195,4 +195,13 @@ dies-ok { EVAL 'my str $x = Str;' }, '"my str $x = Str" dies';
is 42.0, $f, "assign 42.0 to num64";
}

{
sub want-int(int $x) { }
sub want-num(num $x) { }
dies-ok { EVAL 'my num $y = 4e2; want-int($y)' }, 'Passing num to int parameter dies';
dies-ok { EVAL 'my $y = 4e2; want-int($y)' }, 'Passing Num to int parameter dies';
dies-ok { EVAL 'my int $y = 42; want-num($y)' }, 'Passing int to num parameter dies';
dies-ok { EVAL 'my $y = 42; want-num($y)' }, 'Passing Int to num parameter dies';
}

# vim: ft=perl6

0 comments on commit a1c7756

Please sign in to comment.