summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/002-complicated-matching.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/002-complicated-matching.t b/t/002-complicated-matching.t
new file mode 100644
index 0000000..bcf2399
--- /dev/null
+++ b/t/002-complicated-matching.t
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+package Foo;
+use Moose;
+with 'MooseX::Role::Matcher';
+
+has [qw/a b c/] => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1,
+);
+
+package main;
+my $foo = Foo->new(a => 'foo', b => 'bar', c => 'baz');
+ok($foo->match(a => [qr/o/, sub { length(shift) == 4 }]),
+ 'arrayref matching works');
+ok($foo->match(a => [qr/b/, sub { length(shift) == 3 }]),
+ 'arrayref matching works');
+ok(!$foo->match(a => [qr/b/, sub { length(shift) == 4 }]),
+ 'arrayref matching works');
+ok($foo->match(not_a => 'bar', b => 'bar', not_c => 'bar'),
+ 'negated matching works');