Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (30 sloc) 0.607 kb
ad116db [t] move operators/recursive_definition.t to spec/, and add a simpler te...
moritz authored
1 use v6;
2 use Test;
3
4e0660e [S13-overloading/operators.t] added test about postcircumfix:<{ }>
masak authored
4 plan 3;
ad116db [t] move operators/recursive_definition.t to spec/, and add a simpler te...
moritz authored
5
6 #L<S06/Operator overloading>
7
8 {
9 ok eval(q[
10 sub postfix:<§> ($x) {
11 $x * 2;
12 };
13 3§;
14 ]) == 6, 'Can define postfix operator';
15 }
16
17 {
18 ok eval(q[
19 sub postfix:<!>($arg) {
20 if ($arg == 0) { 1;}
21 else { ($arg-1)! * $arg;}
22 };
23 5!
24 ]) == 120, 'Can define recursive postfix operator';
25 }
26
4e0660e [S13-overloading/operators.t] added test about postcircumfix:<{ }>
masak authored
27 {
28 class A does Associative {
29 method postcircumfix:<{ }>(*@ix) {
30 return @ix
31 }
32 };
33
34 is A.new<foo bar>, <foo bar>, 'defining postcircumfix:<{ }> works';
35 }
ad116db [t] move operators/recursive_definition.t to spec/, and add a simpler te...
moritz authored
36
37 # vim: ft=perl6
Something went wrong with that request. Please try again.