Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 25 lines (17 sloc) 0.437 kb
65d39ea [t/spec] tests for code objects in signatures
moritz authored
1 use v6;
2 use Test;
3 plan 2;
4
3caeec0 [t/spec] Added a smartlink and a future move order TODO ;-)
azawawi authored
5 # TODO: move this test to closure-parameters.t if it works in the future
6
7 # L<S06/Closure parameters>
65d39ea [t/spec] tests for code objects in signatures
moritz authored
8
9 our $collector = 2;
10 sub to_be_called($x) {
11 $collector += $x;
12 }
13
14 sub tester(&my_sub) {
15 my_sub(4);
16 }
17
18 tester(&to_be_called);
19 ok $collector == 6, 'Can call my_sub() if &my_sub was a parameter';
20
21 tester(sub ($x) { $collector = 3 * $x });
22 ok $collector == 12, 'same with anonymous sub';
23
24 # vim: ft=perl6
Something went wrong with that request. Please try again.