summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-02-04 03:02:50 -0500
committerdoy <doy@tozt.net>2009-02-04 03:02:50 -0500
commit67ce7ed26c6b6540dcee4fde084ca56e9b5d153e (patch)
tree183ae3120de28c67f8275e780cdd62b5bcaa1e98
parent3b1ce2bf2e7c8e2f106c7344cce3b2ebde3123ee (diff)
downloadmoosex-role-matcher-67ce7ed26c6b6540dcee4fde084ca56e9b5d153e.tar.gz
moosex-role-matcher-67ce7ed26c6b6540dcee4fde084ca56e9b5d153e.zip
add a test for matching against non-existent methods
-rw-r--r--t/102-missing.t21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/102-missing.t b/t/102-missing.t
new file mode 100644
index 0000000..09f4bc6
--- /dev/null
+++ b/t/102-missing.t
@@ -0,0 +1,21 @@
+#!/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',
+);
+
+package main;
+my $foo = Foo->new;
+my $matches = eval { $foo->match(d => 'bar') };
+like($@, qr/^Foo has no method named d/,
+ "match dies when trying to match against a non-existent method");
+ok(!$matches,
+ "and it doesn't match");