Re: Blurring the line between assertions and tests

2003-08-03 Thread Michael G Schwern
On Sat, Aug 02, 2003 at 05:02:58PM +0100, Adrian Howard wrote: > >Or even more trivially, take Test::AtRuntime and swap > >out Test::Builder::ok() with something that dies on failure. > [snip] > > I was thinking about the ability to have an assertion block - so you > could do (something like): >

Re: Blurring the line between assertions and tests

2003-08-03 Thread Michael G Schwern
On Sat, Aug 02, 2003 at 11:43:26AM -0700, Ovid wrote: > This does mean, though, that it won't play nicely with versions of Perl < 5.6.0. Is > that trade > off acceptable? I'll throw in the fallback "if DEBUG" style TEST { my $sky = look('up'); is( $sky, 'blue' ); } if

Re: Blurring the line between assertions and tests

2003-08-03 Thread Michael G Schwern
On Sat, Aug 02, 2003 at 11:22:43AM -0700, chromatic wrote: > Could these instead be subroutine attributes? I can see a lot of > advantages there. I know very little about subroutine attributes, so you're going to have to investigate that one. Keep in mind, though, that we want the *whole call t

Re: Blurring the line between assertions and tests

2003-08-02 Thread Ovid
--- chromatic <[EMAIL PROTECTED]> wrote: > On Friday, August 1, 2003, at 05:03 PM, Michael G Schwern wrote: > > > Ooooh! I just had a great idea. Use "TEST { ... }" instead of "TEST: > > { ... }" > > in Test::AtRuntime. > > Could these instead be subroutine attributes? I can see a lot of > ad

Re: Blurring the line between assertions and tests

2003-08-02 Thread chromatic
On Friday, August 1, 2003, at 05:03 PM, Michael G Schwern wrote: Ooooh! I just had a great idea. Use "TEST { ... }" instead of "TEST: { ... }" in Test::AtRuntime. If the user has Filter::Simple, use that to strip out the TEST blocks. Otherwise, its a function call to TEST() passing in a cod

Re: Blurring the line between assertions and tests

2003-08-02 Thread Adrian Howard
On Saturday, August 2, 2003, at 01:03 am, Michael G Schwern wrote: Class::Contract has always bothered me as way too much Kool-Aid to drink in one sitting. I completely agree. Having the ability to apply pre/post/invariant functionality to normal Perl classes has been on my to do list for years

Re: Blurring the line between assertions and tests

2003-08-02 Thread Michael G Schwern
On Fri, Aug 01, 2003 at 11:02:19PM -, Rafael Garcia-Suarez wrote: > Michael G Schwern wrote in perl.qa : > > The only part missing is the ability to shut the tests off once you've > > released it to production. > > You could perhaps use the assertion feature of perl >= 5.9.0 > (assertion.pm an

Re: Blurring the line between assertions and tests

2003-08-02 Thread Michael G Schwern
On Sat, Aug 02, 2003 at 12:09:22AM +0100, Adrian Howard wrote: > - Rather than running tests at live time, I'm more often doing the > opposite. I have assertions that I only want to switch on at testing > time since that is when I'm exercising things that might break. > > - This sort of

Re: Blurring the line between assertions and tests

2003-08-01 Thread Adrian Howard
On Friday, August 1, 2003, at 09:07 pm, Michael G Schwern wrote: [snip] I was thinking about inline testing, Test::Class and such and how it would be nice if we could just write test functions right in our code, like assertions. Like Carp::Assert::More, but I want all the Test:: stuff available.

Re: Blurring the line between assertions and tests

2003-08-01 Thread Rafael Garcia-Suarez
Michael G Schwern wrote in perl.qa : > The only part missing is the ability to shut the tests off once you've > released it to production. You could perhaps use the assertion feature of perl >= 5.9.0 (assertion.pm and -A switch -- yes I know it lacks docs.)

Re: Blurring the line between assertions and tests

2003-08-01 Thread Michael G Schwern
Make that... http://www.pobox.com/~schwern/src/Test-AtRuntime-0.01.tar.gz -- I knew right away that my pants and your inner child could be best friends.

Re: Blurring the line between assertions and tests

2003-08-01 Thread Michael G Schwern
On Fri, Aug 01, 2003 at 01:07:15PM -0700, Michael G Schwern wrote: > Another way is to use a TEST: block > and have Filter::Simple strip them out. > > TEST: { > cmp_ok( ... ); > } > Questions? Comments? Approval? Hell, why wait for wiser heads? http://www.pobox.com/~schwern/Tes

Blurring the line between assertions and tests

2003-08-01 Thread Michael G Schwern
I had an idea yesterday. On more than one occassion, a I've been asked about running tests against a live site. My usual waffle is to talk about assertions or to build a seperate test suite which is explicitly non-modifying. Or something Skud came up with which was to tag blocks of tests in the s