I was poking around on CPAN and noticed this rather complete
alternative to Pod::Tests for embedding tests in code, a bit closer to
what Barrie was discussing.
I've invited the author onto the list and hopefully he'll say a few
words. I'd also like people to poke around with it, see what its all
about.
NAME
Test::Unit - Procedural style unit testing interface
SYNOPSIS
use Test::Unit;
# your code to be tested goes here
sub foo { return 23 };
sub bar { return 42 };
# define tests
sub test_foo { assert(foo() == 23, "Your message here"); }
sub test_bar { assert(bar() == 42, "I will be printed if this fails"); }
DESCRIPTION
Test::Unit is the procedural style interface to a sophisticated
unit testing framework for Perl that is derived from the JUnit
testing framework for Java by Kent Beck and Erich Gamma. While
this framework is originally intended to support unit testing
in an object-oriented development paradigm (with support for
inheritance of tests etc.), Test::Unit is intended to provide
a simpler interface to the framework that is more suitable for
use in a scripting style environment. Therefore, Test::Unit
does not provide much support for an object-oriented approach
to unit testing - if you want that, please have a look at
Test::Unit::TestCase.