[Pdx-pm] Even more inline testing

Kris Bosland krisb at ring.org
Thu Jun 16 23:16:31 PDT 2005


	I am now doing something similar, but with
a test method, so I have

use Test::Inline::No::Really;

my $t = Test::Inline::No::Really->new; #parses

$t->test;

#I want this to return test results,
#e.g.
#    1..8
#    ok 1 - new() returned something
#    ok 2 -   and it's the right class
#    ok 3 -   sec()
#    ok 4 -   min()
#    ok 5 -   hour()
#    not ok 6 -   day()
#    #     Failed test (- at line 16)
#    #          got: '16'
#    #     expected: '17'
#    ok 7 -   month()
#    ok 8 -   year()
#    # Looks like you failed 1 tests of 8.

#haven't gotten that working yet

Thanks for the advice.  This is a little frustrating up front but I am
looking forward to upfront tests and specification driven coding.

Thanks.

-Kris

On Thu, 16 Jun 2005, Michael G Schwern wrote:

> 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
>
>
> !DSPAM:42b238dd144097936921121!
>
>



More information about the Pdx-pm-list mailing list