diff options
author | doy <doy@tozt.net> | 2008-12-06 23:20:53 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-06 23:20:53 -0500 |
commit | ca7642226a2992e3cc4e4e8345a0fe5be6fef38c (patch) | |
tree | 83c2ea88122b1dc57e6763c125cad9a005808b1b /t/003-methods.t | |
parent | fe814d63a053867c38e9b22c449475ea1573f02e (diff) | |
download | moosex-role-matcher-ca7642226a2992e3cc4e4e8345a0fe5be6fef38c.tar.gz moosex-role-matcher-ca7642226a2992e3cc4e4e8345a0fe5be6fef38c.zip |
more tests
Diffstat (limited to 't/003-methods.t')
-rw-r--r-- | t/003-methods.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/003-methods.t b/t/003-methods.t new file mode 100644 index 0000000..c4c0d5f --- /dev/null +++ b/t/003-methods.t @@ -0,0 +1,26 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 2; + +package Foo; +use Moose; +with 'MooseX::Role::Matcher'; + +has [qw/a b c/] => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub concat { + my $self = shift; + return $self->a . $self->b . $self->c; +} + +package main; +my $foo = Foo->new(a => 'foo', b => 'bar', c => 'baz'); +ok($foo->match(concat => 'foobarbaz'), + 'match handles methods as well as attributes'); +ok($foo->match(a => qr/o/, concat => sub { length(shift) > 6 }), + 'match handles methods as well as attributes'); |