### ----------------------------------------------------
### -- Map::Match
### -- Licenses: Artistic-2.0
### -- Authors: Elizabeth Mattijsen
### -- File: t/01-basic.rakutest
### ----------------------------------------------------
use Test;
use Map::Match;

plan 18;

my %m is Map::Match = foo => 42, b16ar => 666, baz18 => 137;

for <a A ä Á> -> $letter {
    is %m{$letter}.sort, "137 666", "value for $letter";
    is %m($letter, :p).sort, "b16ar\t666 baz18\t137", "value:p for $letter";
}
is %m{ / \d >> / }, "137",     'value for \d >>';
is %m{ / \d >> / }:k, "baz18", 'value for \d >> :k';
is %m{ / z.8 / }, "137",       'value for z.8';

is-deeply %m{ / r.b / }, Empty, 'does r.b bleed into "b16ar\0baz18"';

is-deeply Map::Match.raku, 'Map::Match', 'does .raku work on type object';
quietly is-deeply Map::Match.Str, '',       'does .Str  work on type object';
is-deeply Map::Match.gist, '(Match)',    'does .gist work on type object';

is %m{ / ^ f / },     42, 'did we get value with "^ f"';
is %m{ / o $ / },     42, 'did we get value with "o $"';
is %m{ / ^ foo $ / }, 42, 'did we get value with "^ foo $"';

# vim: expandtab shiftwidth=4


