Skip to content

Commit 481a9eb

Browse files
committed
add tests for autogen of metaops
1 parent 3185bb0 commit 481a9eb

File tree

6 files changed

+27
-6
lines changed

6 files changed

+27
-6
lines changed

S03-metaops/cross.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22

33
use Test;
4-
plan 50;
4+
plan 51;
55

66
# L<S03/List infix precedence/the cross operator>
77
ok EVAL('<a b> X <c d>'), 'cross non-meta operator parses';
@@ -168,4 +168,6 @@ is (1,2 X (<a b> X "x")).flat.join, '1ax1bx2ax2bx',
168168
throws-like '3 X. foo', X::Syntax::CannotMeta, "X. is too fiddly";
169169
throws-like '3 X. "foo"', X::Obsolete, "X. can't do P5 concat";
170170

171+
is-deeply &infix:<X+>((1,2,3),(4,5,6)), (5, 6, 7, 6, 7, 8, 7, 8, 9), "Meta X can autogen";
172+
171173
# vim: ft=perl6

S03-metaops/hyper.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use v6;
22

33
use Test;
44

5-
plan 386;
5+
plan 390;
66

77
=begin pod
88
@@ -1017,4 +1017,9 @@ throws-like '3 «.» foo', X::Obsolete, "«.» can't be hypered";
10171017
'hyper op works with (finite) range on non-magical side (3)';
10181018
}
10191019

1020+
is-deeply &infix:<»+«>((1,2,3),(4,5,6)), (5, 7, 9), "Hyper >><< can autogen";
1021+
is-deeply &infix:<»+»>((1,2,3),1), (2, 3, 4), "Hyper >>>> can autogen";
1022+
is-deeply &infix:<«+«>(1,(4,5,6)), (5, 6, 7), "Hyper <<<< can autogen";
1023+
is-deeply &infix:<«+»>((1,2),(4,5,6)), (5, 7, 7), "Hyper <<>> can autogen";
1024+
10201025
# vim: ft=perl6

S03-metaops/not.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 41;
4+
plan 44;
55

66
=begin pod
77
@@ -65,4 +65,8 @@ nok False !^^ True, '!^^ is legal and works (2)';
6565
throws-like '3 !. foo', X::Syntax::CannotMeta, "!. is too fiddly";
6666
throws-like '3 !. "foo"', X::Obsolete, "!. can't do P5 concat";
6767

68+
is &infix:<!===>(1,2), True, "Meta not can autogen (!===)";
69+
is &infix:<!%%>(3,2), True, "Meta not can autogen (!%%)";
70+
is &infix:<![!%%]>(3,2), False, "Meta not can autogen (![!%%])";
71+
6872
# vim: ft=perl6

S03-metaops/reduce.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use v6;
22
use Test;
3-
plan 372;
3+
plan 374;
44

55
=begin pod
66
@@ -395,4 +395,7 @@ ok ([+]) == 0, 'argumentless [+] parses';
395395
}
396396

397397

398+
is &prefix:<[**]>(2,3,4), 2417851639229258349412352, "Reduce ** can autogen";
399+
is &prefix:<[R**]>(2,3,4), 262144, "Reduce R** can autogen";
400+
398401
# vim: ft=perl6

S03-metaops/reverse.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 42;
4+
plan 44;
55

66
=begin pod
77
@@ -98,4 +98,8 @@ throws-like '("a" R~ "b") = 1', X::Assignment::RO, 'Cannot assign to return valu
9898

9999
throws-like '3 R. foo', X::Syntax::CannotMeta, "R. is too fiddly";
100100
throws-like '3 R. "foo"', X::Obsolete, "R. can't do P5 concat";
101+
102+
is &infix:<R/>(1,2), 2, "Meta reverse R/ can autogen";
103+
is &infix:<RR/>(1,2), 0.5, "Meta reverse RR/ can autogen";
104+
101105
# vim: ft=perl6

S03-metaops/zip.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22

33
use Test;
4-
plan 49;
4+
plan 51;
55

66
ok EVAL('<a b> Z <c d>'), 'zip non-meta operator parses';
77

@@ -119,4 +119,7 @@ is (1, 2 Z, 3, 4).flat.join('|'), '1|3|2|4', 'Z, flattens in list context';
119119
throws-like '3 Z. foo', X::Syntax::CannotMeta, "Z. is too fiddly";
120120
throws-like '3 Z. "foo"', X::Obsolete, "Z. can't do P5 concat";
121121

122+
is-deeply &infix:<Z+>((1,2,3),(4,5,6)), (5, 7, 9), "Meta zip can autogen";
123+
is-deeply &infix:<Z+>((1,2,3),(1,2,3),(1,2,3)), (3, 6, 9), "Meta zip can autogen (3-ary)";
124+
122125
# vim: ft=perl6

0 commit comments

Comments
 (0)