Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 34 lines (24 sloc) 1.064 kB
0df5ccb [t/spec] Basic tests for meta-operators generated from user defined o…
jnthn authored
1 use v6;
2 use Test;
3
4 plan 9;
5
6 #L<S06/Operator overloading>
7
8 # Define operator, check it works.
9 sub infix:<wtf>($a, $b) { $a ~ "WTF" ~ $b };
10 is 'OMG' wtf 'BBQ', 'OMGWTFBBQ', 'basic sanity';
11
12 # Assignment meta-op.
13 my $a = 'OMG';
14 $a wtf= 'BBQ';
15 is $a, 'OMGWTFBBQ', 'assignment meta-op';
16
17 # Reduce meta-op.
18 is ([wtf] <OMG BBQ PONIES>), 'OMGWTFBBQWTFPONIES', 'reduce meta-op generated';
19
20 # Reverse meta-op.
21 is 'BBQ' Rwtf 'OMG', 'OMGWTFBBQ', 'reverse meta-op generated';
22
23 # Cross meta-op.
defe8f0 [metaoperators] test that Xwtf is list infixy
lwall authored
24 is ~('OMG','BBQ' Xwtf 'OMG','BBQ'), 'OMGWTFOMG OMGWTFBBQ BBQWTFOMG BBQWTFBBQ',
0df5ccb [t/spec] Basic tests for meta-operators generated from user defined o…
jnthn authored
25 'cross meta-op generated';
26
27 # Hyper meta-op (todo: unicode variants, check variants apply correct constraints)
28 is ~(('OMG','BBQ') >>wtf<< ('BBQ','OMG')), 'OMGWTFBBQ BBQWTFOMG', '>>...<< hyper generated';
29 is ~(('OMG','BBQ') <<wtf<< ('BBQ','OMG')), 'OMGWTFBBQ BBQWTFOMG', '<<...<< hyper generated';
30 is ~(('OMG','BBQ') >>wtf>> ('BBQ','OMG')), 'OMGWTFBBQ BBQWTFOMG', '>>...>> hyper generated';
31 is ~(('OMG','BBQ') <<wtf>> ('BBQ','OMG')), 'OMGWTFBBQ BBQWTFOMG', '<<...>> hyper generated';
32
33 # vim: ft=perl6
Something went wrong with that request. Please try again.