Re: Test::Code

2005-08-17 Thread Ovid
--- demerphq <[EMAIL PROTECTED]> wrote: > One idea might be to try using Data::Dump::Streamer for your tests. > It > will serialize the lexical context that the subroutine was compiled > with (including bound anonymous subroutines and their lexical > context). > > A small hack (that i would be ha

Re: Test::Code

2005-08-17 Thread demerphq
On 8/11/05, Ovid <[EMAIL PROTECTED]> wrote: > X-Posted to Perlmonks (http://perlmonks.org/index.pl?node_id=483100) > > I frequently write code that generates anonymous functions on the fly. > However, I often want to verify that these functions are correct > without executing them. To this end, I

Re: Test::Code

2005-08-12 Thread Ricardo SIGNES
* David Golden <[EMAIL PROTECTED]> [2005-08-12T09:10:21] > Won't "&is_code" get called that way? Should this be: > > ok defined \&is_code; No. C will do the right thing, here. Taking a reference to an undefined sub, however, will always return a defined value: a coderef that, when called,

Re: Test::Code

2005-08-12 Thread David Golden
Ivan Tubert-Brohman wrote: Isn't ok defined *::is_code{CODE}; just a convoluted way of saying ok defined &is_code; Won't "&is_code" get called that way? Should this be: ok defined \&is_code; David Golden

Re: Test::Code

2005-08-11 Thread James E Keenan
Ovid wrote: X-Posted to Perlmonks (http://perlmonks.org/index.pl?node_id=483100) I frequently write code that generates anonymous functions on the fly. However, I often want to verify that these functions are correct without executing them. To this end, I've started writing Test::Code. Here'

Re: Test::Code

2005-08-11 Thread Ovid
--- Ivan Tubert-Brohman <[EMAIL PROTECTED]> wrote: > Isn't > >ok defined *::is_code{CODE}; > > just a convoluted way of saying > >ok defined &is_code; Er, yes. It is. That's just a really bad habit on my part. I do a fair amount of typeglob diddling, so that tends to stick in my min

Re: Test::Code

2005-08-11 Thread Ivan Tubert-Brohman
Michael G Schwern wrote: On Thu, Aug 11, 2005 at 02:49:57PM -0700, Ovid wrote: BEGIN { use_ok 'Test::Code' or die } ok defined *::is_code{CODE}, '&is_code should be exported to our namespace'; I usually do this with can_ok() can_ok( __PACKAGE__, qw(is_code isnt_code) ); Isn'

Re: Test::Code

2005-08-11 Thread Ovid
--- Michael G Schwern <[EMAIL PROTECTED]> wrote: > > ok defined *::is_code{CODE}, > > '&is_code should be exported to our namespace'; > > I usually do this with can_ok() > > can_ok( __PACKAGE__, qw(is_code isnt_code) ); I specifically avoid that with methods because &can_ok provides

Re: Test::Code

2005-08-11 Thread Michael G Schwern
On Thu, Aug 11, 2005 at 02:49:57PM -0700, Ovid wrote: > BEGIN { use_ok 'Test::Code' or die } > > ok defined *::is_code{CODE}, > '&is_code should be exported to our namespace'; I usually do this with can_ok() can_ok( __PACKAGE__, qw(is_code isnt_code) ); > is_code sub { 1 }, s