Manual Reference Pages - TEST::SUBCALLS (3)

CONTENTS

use Test::SubCalls;
# Start tracking calls to a named sub
sub_track( Foo::foo );
# Run some test code
...
# Test that some sub deep in the codebase was called
# a specific number of times.
sub_calls( Foo::foo, 5 );
sub_calls( Foo::foo, 5, Use a custom test message );
# Reset the counts for one or all subs
sub_reset( Foo::foo );
sub_reset_all();

There are a number of different situations (like testing caching code)
where you want to want to do a number of tests, and then verify that
some underlying subroutine deep within the code was called a specific
number of times.

This module provides a number of functions for doing testing in this way
in association with your normal Test::More (or similar) test scripts.