From 67ce7ed26c6b6540dcee4fde084ca56e9b5d153e Mon Sep 17 00:00:00 2001 From: doy Date: Wed, 4 Feb 2009 03:02:50 -0500 Subject: add a test for matching against non-existent methods --- t/102-missing.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 t/102-missing.t 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"); -- cgit v1.2.3-54-g00ecf