diff options
author | doy <doy@tozt.net> | 2008-12-06 18:45:30 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-06 18:45:30 -0500 |
commit | 3255b94c24b077997a65e0ca5a4b18854136c786 (patch) | |
tree | fedeff81a8cb5810f128e5623433b8f4c860a93a /t | |
parent | 90baa2991ada3a9b53f8b21b7e4a1991dd55cdc6 (diff) | |
download | moosex-role-matcher-3255b94c24b077997a65e0ca5a4b18854136c786.tar.gz moosex-role-matcher-3255b94c24b077997a65e0ca5a4b18854136c786.zip |
tests
Diffstat (limited to 't')
-rw-r--r-- | t/002-complicated-matching.t | 25 |
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'); |