lukec / cpan-mocked

mocked.pm unit test helper module

This URL has Read+Write access

Luke Closs (author)
Tue Dec 11 12:35:12 -0800 2007
commit  80fb48a139a169cf925d97a17ac3a4f20feb43c7
tree    3b2ba8d5931e6bf5a0bdd2b6b732c8a737de89f4
parent  df1d454d6571c90c326d613d1dd098a428aed51f
name age message
file Changes Loading commit data...
file MANIFEST
file Makefile.PL
file README
directory inc/
directory lib/
directory t/
README
mocked - use mocked libraries in unit tests

Synopsis:

  # use a fake LWP::Simple for testing from t/lib/LWP/Simple.pm
  use mocked 'LWP::Simple';
  my $text = get($url);


Often during unit testing, you may find the need to use mocked libraries
to test edge cases, or prevent unit tests from using slow or external
code.

This is where mocking libraries can help.

When you mock a library, you are creating a fake one that will be used
in place of the real one.  The code can do as much or as little as is
needed.

Use mocked.pm as a safety measure (so it actually loads the right
module), and as a way to document the tests for future maintainers.