On Sat, Nov 14, 2009 at 10:29:20PM -0600, Jonathan Rockway wrote:
> * On Mon, Nov 09 2009, David Cantrell wrote:
> > On Mon, Nov 09, 2009 at 11:41:21AM +0100, Philippe Bruhat (BooK) wrote:
> >> On Mon, Nov 09, 2009 at 02:24:11AM -0800, Ovid wrote:
> >> > Thinking about this more, what about a compile_ok()?
> >> compile_ok() would certainly be interesting with scripts shipped with
> >> a module, that usually have very little meat that needs testing (since
> >> most of the work is done in the modules), but that one would at least
> >> check that they compile.
> > Why not test that the script *works*, not just that it compiles?
> Why use a script at all?

Because it makes your user's life easier.  More importantly, assuming
that you wrote the code because it scratches your itch, it makes *your*
life easier.

>                          They are clearly difficult to test, and code
> that is difficult to test is where the bugs always hide.

They're not really more difficult to test than any other code of similar
size and complexity, at least if they're not interactive.  Just like
with all other tests, you set up the environment, execute the script with
the right arguments, and check that it Does The Right Thing.  To me,
that sounds remarkably similar to setting up your database, calling a
subroutine, and making sure it had the right side-effects.

-- 
David Cantrell | Official London Perl Mongers Bad Influence

    Support terrierism! Adopt a dog today!

Reply via email to