in reply to Re^3: Being more Assert-ive with Perl
in thread Being more Assert-ive with Perl

Hm. Imagine a tool that takes all our declared contracts and composes a huge test suite that tries to test whether each contract is respected in our code, say, by feeding a series of valid and invalid data and turning off all runtime contract checks.

I like the idea of a tool, but why turn off all runtime contract checks? Wouldn't you want them in there to catch the errors?

And, putting dreams aside, I'm going now to read about specification testing and try Test::LectroTest :)

Me too, Test::LectroTest looks very cool.

-stvn

Replies are listed 'Best First'.
Re^5: Being more Assert-ive with Perl
by kappa (Chaplain) on Sep 17, 2004 at 16:18 UTC
    I like the idea of a tool, but why turn off all runtime contract checks? Wouldn't you want them in there to catch the errors?

    What's the point of testing the code below with something but positive numbers?

    is_numeric($_[0]) && $_[0] > 0 or die "Invalid input, give me a positi +ve number\n"; # is_numeric taken from perlfaq4

    This check is here for a reason and we'd like to test the reasoning. Will it die horribly trying to multiply a hashref by two or taking a square root of -100? Will it just plain lie?