[Pdx-pm] Even more inline testing

Michael G Schwern schwern at pobox.com
Thu Jun 16 19:43:29 PDT 2005

On Thu, Jun 16, 2005 at 01:59:51PM -0700, Kris Bosland wrote:
> I am looking for a system that will let me run inline tests
> without making a separate file.

Test::Class.  Doesn't matter if your code is a class or not, it'll work.
The syntax is a bit different, tests in methods instead of tests in POD,
but the idea is the same.

> I have found Pod::Tests, so I guess I could write
> Test::Inline::No::Really like this:
> =================================================
> package Test::Inline::No::Really;
> use Pod::Tests;
> sub import {
>   my $p = Pod::Tests->new;
>   $p->parse_file($0);
>   eval $p->build_tests($p->tests);
> }
> =================================================
> I thought there was an existing package like this
> but I haven't found it after some googling today.
> Can anyone give me some links or ideas?

That looks fairly sensible to me, though I never liked the "import == testing"
thing.  Seems too surprising and also walls off the "use Foo" interface from
other uses.  Slightly better to have to pass in a :test flag or something.

Michael G Schwern     schwern at pobox.com     http://www.pobox.com/~schwern
Don't try the paranormal until you know what's normal.
	-- "Lords and Ladies" by Terry Prachett

More information about the Pdx-pm-list mailing list