Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests for RT #119919 and RT #117737.
  • Loading branch information
peschwa committed Oct 4, 2015
1 parent 5f82bde commit 21a9ea0
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion S06-operator-overloading/sub.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 77;
plan 84;

=begin pod
Expand Down Expand Up @@ -474,4 +474,32 @@ Testing operator overloading subroutines
is $RT115724 , 111, 'can define and use circumfix operator with a double quote (")';
}
# RT #117737
{
throws-like { EVAL q< sub infix:[/./] { 42 } > },
X::Syntax::Extension::TooComplex,
message => "Colon pair value '/./' too complex to use in name",
'infix definition for /./ fails with X::Syntax::Extension::TooComplex';
}
# RT #119919
{
lives-ok { sub infix:["@"] ($a, $b) { 42 } },
'can define infix with brackets as delimiter';
my $RT119919 = EVAL 'sub infix:["@"] ($a, $b) { 42 }; 5@5';
is $RT119919, 42, 'can define and use infix with brackets as delimiter';
lives-ok { sub circumfix:["@", "@"] ($a) { $a } },
'can define circumfix with brackets as delimiter';
$RT119919 = EVAL 'sub circumfix:["@", "@"] ($a) { $a }; @ 5 @';
is $RT119919, 5, 'can define and use circumfix with brackets as delimiter';
constant sym = "µ";
sub infix:[sym] { "$^a$^b" };
is 5 µ 5, "55", 'can define and use operator with a sigilless constant as symbol';
constant $sym = "°";
sub infix:[$sym] { "$^a$^b" };
is 5 ° 5, "55", 'can define and use operator with a sigiled constant as symbol';
}
# vim: ft=perl6

0 comments on commit 21a9ea0

Please sign in to comment.