summaryrefslogtreecommitdiffstats
path: root/t/basic.t
blob: 39b564cbc89e1150121a1f3f48986ff2cff67636 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

ok(1 ~~ 1);
{
    use smartmatch sub { 0 };
    ok(!(1 ~~ 1));
    ok(!(1 ~~ 2));
}
ok(1 ~~ 1);

{
    package smartmatch::engine::foo;
    sub match { ref($_[1]) eq 'ARRAY' }
}

{
    use smartmatch 'foo';
    ok([] ~~ qr/ARRAY/);
    ok(!(1 ~~ sub { 0 }));
}

done_testing;