Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
30 lines (25 sloc) 0.652 kB
use v6;
use Test;
plan 8;
#L<S03/Smart matching/Any Any scalars are identical>
{
class Smartmatch::ObjTest {}
my $a = Smartmatch::ObjTest.new;
my $b = Smartmatch::ObjTest.new;
ok ($a ~~ $a), 'Any ~~ Any (+)';
ok !($a !~~ $a), 'Any !~~ Any (-)';
ok !($a ~~ $b), 'Any ~~ Any (-)';
ok ($a !~~ $b), 'Any !~~ Any (+)';
}
{
$_ = 42;
my $x;
'abc' ~~ ($x = $_);
is $x, 'abc', '~~ sets $_ to the LHS';
is $_, 42, 'original $_ restored';
'defg' !~~ ($x = $_);
is $x, 'defg', '!~~ sets $_ to the LHS';
is $_, 42, 'original $_ restored';
'defg' !~~ ($x = $_);
}
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.