[tap-l] pgTAP

Aristotle Pagaltzis pagaltzis at gmx.de
Sat Jun 14 04:18:12 UTC 2008


* David E. Wheeler <david at kineticode.com> [2008-06-11 21:00]:
> The project page for it should appear here in a day or two:
> 
>   http://pgfoundry.org/projects/pgtap/
> 
> It includes a Perl app, pg_prove, that works just like prove,
> but use psql under the hood, and has relevant options for it.

I think a separate utility is not necessary at all. `prove` has
an `-e` switch which can be used to specify an interpreter to run
the given scripts with, so all you should need to say is roughly

    prove -epsql t/*.s

> So the question: How do I modify `make test` and/or `./Build
> test` so that they can use a single TAP::Harness to process
> both types of tests, but send *.t tests to Perl and *.s tests
> to psql?

I just spent an hour poring over the docs and code of M::B but
found no easy way to do what you want. There’s the following
sample code in the section on the `testall` target:

    my $mb = Module::Build->subclass(
        code => q(
            sub ACTION_testspecial { shift->generic_test(type => 'special'); }
            sub ACTION_testauthor  { shift->generic_test(type => 'author'); }
        )
    );
    
    $mb->new(
        # ...
        test_types  => {
            special => '.st',
            author  => '.at',
        },
        # ...

However, there is no existing way to get harness switches passed
in based on the filename extension, and the factorisation of the
`generic_test` method and its helpers is such that you can’t
really use any of the bits in isolation.

It feels like this should be much easier… which I have to say is
a feeling I often get when I try to extend M::B in any direction
it doesn’t already explicitly accomodate.

Of course the alternative is EU::MM where I have no desire to
even try doing any interesting stuff at all.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>


More information about the tap-l mailing list