Skip to content

Commit

Permalink
Coverage for crashes in certain custom operator setups
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 11, 2017
1 parent 0d87100 commit 8cbbf89
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion S06-operator-overloading/prefix.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 9;
plan 10;

{
sub prefix:<X> ($thing) { return "ROUGHLY$thing"; };
Expand Down Expand Up @@ -49,3 +49,30 @@ plan 9;
is(-"fish", "CROSSfish",
'prefix operator overloading for existing operator');
}
# RT #123216
subtest 'coverage for crashes in certain operator setups' => {
plan 2;
is-deeply do {
sub postfix:<_post_l_>($a) is assoc<left> is equiv(&prefix:<+>) {
"<$a>"
}
sub prefix:<_pre_l_> ($a) is assoc<left> is equiv(&prefix:<+>) {
"($a)"
}
(_pre_l_ 'a')_post_l_
}, '<(a)>', '(1)';
is-deeply do {
sub infix:«MYPLUS»(*@a) is assoc('list') {
[+] @a;
}
sub prefix:«MYMINUS»($a) is looser(&infix:<MYPLUS>) {
-$a;
}
(MYMINUS 1 MYPLUS 2 MYPLUS 3)
}, -6, '(2)';
}

0 comments on commit 8cbbf89

Please sign in to comment.