Permalink
Browse files

[t/spec] Test for RT #68116

git-svn-id: http://svn.pugscode.org/pugs@27954 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent aa7a009 commit 53e37b5ce5925ed40c1118b8aa2a0d802a419bd2 kyle committed Aug 10, 2009
Showing with 24 additions and 1 deletion.
  1. +24 −1 S02-builtin_data_types/anon_block.t
@@ -11,7 +11,7 @@ This covers anonymous blocks and subs, as well as pointy blocks
=end description
-plan 34;
+plan 42;
# L<S04/"The Relationship of Blocks and Declarations">
# L<S06/"Anonymous subroutines">
@@ -126,4 +126,27 @@ is((sub { { { 3 } } }).(), 3, 'ditto, even if nested');
dies_ok({(sub { { $^x } }).()}, 'implicit params become errors');
isnt((sub { -> { 3 } }).(), 3, 'as are pointies');
+# RT #68116
+{
+ sub rt68116 { 68116 }
+ is &rt68116(), 68116, 'check that sub is callable via &';
+ is { &^x() }.( &rt68116 ), 68116,
+ 'call via { &^pos() }( &s ) works for sub';
+ is -> &x { &x() }.( &rt68116 ), 68116,
+ 'call via -> &point { &point() }.( &s ) works for sub';
+ is (sub (&x) { &x() }).( &rt68116 ), 68116,
+ 'call via (sub (&x) { &x() }).( &s ) works for sub';
+
+ multi mone { 'one' }
+ is &mone(), 'one', 'check that mutli is callable via &';
+ #?rakudo 3 skip 'RT #68116'
+ is { &^x() }.( &mone ), 'one',
+ 'call via { &^pos() }( &s ) works for multi';
+ is -> &x { &x() }.( &mone ), 'one',
+ 'call via -> &point { &point() }.( &s ) works for multi';
+ is (sub (&x) { &x() }).( &mone ), 'one',
+ 'call via (sub (&x) { &x() }).( &s ) works for multi';
+
+}
+
# vim: ft=perl6

0 comments on commit 53e37b5

Please sign in to comment.