Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (19 sloc) 0.913 kb
use v6;
use Test;
plan 8;
# a scalar parameter can be bound to any type below Any, and should
# preserve its type
{
sub foo( $arg ) { return $arg.WHAT }
sub make_array() { return ['were','there'] }
sub make_hash() { return {'z'=>'y','x'=>'w'} }
is( foo([]), ::Array, "anon-def empty array arg defined inline" );
is( foo(['hello']), ::Array, "anon-def 1-elem array arg defined inline" );
is( foo(['hello','world']), ::Array, "anon-def 2-elem array arg defined inline" );
is( foo(make_array()), ::Array, "2-elem array arg, sub-returned, invoked inline" );
is( foo(hash()), ::Hash, "anon-def empty hash arg defined inline" );
is( foo({'a'=>'b'}), ::Hash, "anon-def 1-elem hash arg defined inline" );
is( foo({'a'=>'b','c'=>'d'}), ::Hash, "anon-def 2-elem hash arg defined inline" );
is( foo(make_hash()), ::Hash, "2-elem hash arg, sub-returned, invoked inline" );
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.