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

20 lines (16 sloc) 0.612 kb
use v6;
use Test;
plan 7;
#L<S03/Smart matching/Hash Pair test hash mapping>
{
my %a = (a => 1, b => 'foo', c => Mu);
ok (%a ~~ b => 'foo'), '%hash ~~ Pair (Str, +)';
ok !(%a ~~ b => 'ugh'), '%hash ~~ Pair (Str, -)';
ok (%a ~~ a => 1.0), '%hash ~~ Pair (Num, +)';
ok (%a ~~ :b<foo>), '%hash ~~ Colonpair';
ok (%a ~~ c => !*.defined), '%hash ~~ Pair (!*.defined, Mu)';
ok (%a ~~ d => !*.defined), '%hash ~~ Pair (!*.defined, Nil)';
ok !(%a ~~ a => 'foo'), '%hash ~~ Pair (key and val not paired)';
}
done;
# vim: ft=perl6
Jump to Line
Something went wrong with that request. Please try again.