Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (27 sloc) 0.968 kb
use v6;
use Test;
plan 9;
=begin pod
Perl 6 has an explicitly declared C<=~> which should die at compile time
and is intended to catch user "brainos"; it recommends C<~~> to the user
instead. Similar for C<!~>.
=end pod
#L<S03/Chaining binary precedence/"To catch">
my $str = 'foo';
try { eval '$str =~ m/bar/;' };
ok $! ~~ Exception, 'caught "=~" braino';
ok "$!" ~~ /'~~'/, 'error for "=~" usage mentions "~~"';
try { eval '$str !~ m/bar/;' };
ok $! ~~ Exception, 'caught "!~" braino';
ok "$!" ~~ /'!~~'/, 'error for "!~" usage mentions "!~~"';
# RT #76878
#?rakudo skip 'RT 76878'
{
my $x = 2;
is eval('"$x =~ b"'), '2 =~ b', '=~ allowed in double quotes';
is eval('"$x !~ b"'), '2 !~ b', '!~ allowed in double quotes';
is eval('"$x << b"'), '2 << b', '<< allowed in double quotes';
is eval('"$x >> b"'), '2 >> b', '>> allowed in double quotes';
is eval('"$x . b"'), '2 . b', '. allowed in double quotes';
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.