spencer portee > Test-Pockito > Test::Pockito::DefaultMatcher

Download:
Test-Pockito-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Source  

NAME ^

Test::Pockito::DefaultMatcher

SYNOPSIS ^

Default matching for Pockito

DESCRIPTION ^

Default implementation of matching. If none of the any_* subs are used for matching, then it reverts to a ne op for matching.

SUBROUTINES ^

default_call_match( $package, $method, \@params_found, \@params_expected )

This is the default matching metchanism for Pockito though you are at will to implement your own. Passing an implementation with this signature overrides the matching sub. The default implementation does not use $package nor $method, but they will be of use if you have multiple, different ways to define parameters as equal.

MATCHERS ^

All the following matchers can be exported or refered to by package name. They use Scalar::Util::Reftype under the hood except for is_defined.

        is_defined
        is_scalar
        is_array
        is_hash
        is_code
        is_global
        is_lvalue
        is_regexp
        is_scalar_object
        is_array_object
        is_hash_object
        is_code_object
        is_glob_object
        is_lvalue_object
        is_ref_object
        is_io_object
        is_regexp_object

With these, one can write:

        $pocket->when( $mock->( is_defined, is_regexp, 1, 2, is_code_object )->...

to match

        any defined value
        any regular expression ref
        the value 1
        the value 2
        any blessed code ref

SUPPORT ^

exussum@gmail.com

AUTHOR ^

Spencer Portee CPAN ID: EXUSSUM exussum@gmail.com

SOURCE ^

http://bitbucket.org/exussum/pockito/

COPYRIGHT ^

This program is free software licensed under the...

    The BSD License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO ^

perl(1).

syntax highlighting: