Commit | Line | Data |
9642eea0 |
1 | #!perl |
2 | |
3 | use Test::More tests => 11; |
4 | |
5 | use warnings FATAL => 'all'; |
6 | use strict; |
7 | |
8 | use Function::Parameters; |
9 | |
10 | fun four { 2 + 2 } fun five() { 1 + four } |
11 | |
12 | fun quantum :() {; 0xf00d |
13 | } |
14 | |
15 | is four, 4, "basic sanity 1"; |
16 | is five, 5, "basic sanity 2"; |
17 | is quantum, 0xf00d, "basic sanity 3"; |
18 | is quantum / 2 #/ |
19 | , 0xf00d / 2, "basic sanity 4 - () proto"; |
20 | |
21 | is eval('my $x = fun forbidden {}'), undef, "statements aren't expressions"; |
c311cef3 |
22 | like $@, qr/expect.*function body/; |
9642eea0 |
23 | |
24 | is eval('my $x = { fun forbidden {} }'), undef, "statements aren't expressions 2 - electric boogaloo"; |
c311cef3 |
25 | like $@, qr/expect.*function body/; |
9642eea0 |
26 | |
27 | is fun { join '.', five, four }->(), '5.4', "can immedicall anon subs"; |
28 | |
29 | is 0 * fun {} + 42, 42, "* binds tighter than +"; |
30 | is 0 * fun { quantum / q#/ } |
31 | # } + 42, 42, "* binds tighter than + 2 - electric boogaloo"; |