From 3255b94c24b077997a65e0ca5a4b18854136c786 Mon Sep 17 00:00:00 2001 From: doy Date: Sat, 6 Dec 2008 18:45:30 -0500 Subject: tests --- t/002-complicated-matching.t | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 t/002-complicated-matching.t 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'); -- cgit v1.2.3-54-g00ecf