Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test for #64814

git-svn-id: http://svn.pugscode.org/pugs@27631 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 45592a28400a928a534dd80ece1b4d417a221c1c 1 parent e3d9b81
kyle authored
Showing with 41 additions and 1 deletion.
  1. +41 −1 S06-signature/slurpy-params.t
View
42 S06-signature/slurpy-params.t
@@ -3,7 +3,7 @@ use Test;
# L<S06/List parameters/Slurpy parameters>
-plan 45;
+plan 59;
sub xelems(*@args) { @args.elems }
sub xjoin(*@args) { @args.join('|') }
@@ -223,4 +223,44 @@ L<S06/List parameters/Slurpy scalar parameters capture what would otherwise be t
is @copied, @not_copied, 'slurpy array copy same as not copied';
}
+# RT #64814
+{
+ sub slurp_any( Any *@a ) { @a[0] }
+ lives_ok { slurp_any( 'foo' ) }, 'can call sub with (Any *@a) sig';
+ is slurp_any( 'foo' ), 'foo', 'call to sub with (Any *@a) works';
+
+ sub slurp_int( Int *@a ) { @a[0] }
+ #?rakudo todo 'RT #64814'
+ lives_ok { slurp_int( 27.int ) }, 'can call sub with (Int *@a) sig';
+ dies_ok { slurp_int( 'foo' ) }, 'dies: call (Int *@a) sub with string';
+ #?rakudo skip 'RT #64814'
+ is slurp_int( 27.int ), 27, 'call to sub with (Int *@a) works';
+
+ sub slurp_of_int( *@a of Int ) { @a[0] }
+ lives_ok { slurp_of_int( 64814.int ) }, 'can call (*@a of Int) sub';
+ #?rakudo todo 'RT #64814'
+ dies_ok { slurp_of_int( 'foo' ) }, 'dies: call (*@a of Int) with string';
+ is slurp_of_int( 99.int ), 99, 'call to (*@a of Int) sub works';
+
+ class X64814 {}
+ class Y64814 {
+ method x_slurp ( X64814 *@a ) { 2 }
+ method of_x ( *@a of X64814 ) { 3 }
+ method x_array ( X64814 @a ) { 4 }
+ }
+
+ my $x = X64814.new;
+ my $y = Y64814.new;
+ #?rakudo todo 'RT #64814'
+ lives_ok { $y.x_array( $x ) }, 'can call method with typed array sig';
+ lives_ok { $y.of_x( $x ) }, 'can call method with "slurp of" sig';
+ #?rakudo todo 'RT #64814'
+ lives_ok { $y.x_slurp( $x ) }, 'can call method with typed slurpy sig';
+ #?rakudo todo 'RT #64814'
+ dies_ok { $y.x_array( 23 ) }, 'die calling method with typed array sig';
+ #?rakudo todo 'RT #64814'
+ dies_ok { $y.of_x( 17 ) }, 'dies calling method with "slurp of" sig';
+ dies_ok { $y.x_slurp( 35 ) }, 'dies calling method with typed slurpy sig';
+}
+
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.