Re: perl6-ish idiom for code and tests in one file

2007-01-07 Thread gabriele renzi
Larry Wall ha scritto: but the autocall into MAIN is not yet implemented. You can emulate by putting something like this as the last line in your file: MAIN(@ARGS), exit if $?FILE eq $*PROGRAM_NAME; or maybe MAIN(@ARGS), exit unless caller; if/when that works as in Perl 5. When the

Re: perl6-ish idiom for code and tests in one file

2007-01-07 Thread gabriele renzi
Larry Wall ha scritto: On Fri, Jan 05, 2007 at 01:40:44PM +0200, Gaal Yahas wrote: : > I think it should be possible and nice to use a macro (possibly a : > standard subroutine, I'm not sure) like : > : > testing { : > ok foo; : > } : > : > would it make sense or I'm just crazy? : : I like

Re: perl6-ish idiom for code and tests in one file

2007-01-05 Thread Larry Wall
On Fri, Jan 05, 2007 at 01:40:44PM +0200, Gaal Yahas wrote: : > I think it should be possible and nice to use a macro (possibly a : > standard subroutine, I'm not sure) like : > : > testing { : > ok foo; : > } : > : > would it make sense or I'm just crazy? : : I like the approach. I think you

Re: perl6-ish idiom for code and tests in one file

2007-01-05 Thread Juerd
gabriele renzi skribis 2007-01-05 4:14 (+0100): > I think it should be possible and nice to use a macro (possibly a > standard subroutine, I'm not sure) like > testing { > ok foo; > } > would it make sense or I'm just crazy? Possible, presumably easy to implement, and a great idea. I love it!

Re: perl6-ish idiom for code and tests in one file

2007-01-05 Thread Gaal Yahas
On Fri, Jan 05, 2007 at 04:14:27AM +0100, gabriele renzi wrote: > supposing that I want to keep code and tests in one single file, is > there a common idiom to do that? Nice idea! > At the moment I'm going with something like: > > if $?FILE == $*PROGRAM_NAME { > use Test; > plan 1; > ok

perl6-ish idiom for code and tests in one file

2007-01-05 Thread gabriele renzi
Hi everyone, supposing that I want to keep code and tests in one single file, is there a common idiom to do that? At the moment I'm going with something like: if $?FILE == $*PROGRAM_NAME { use Test; plan 1; ok foo(); } but this seem unnecessarily verbose. Is there some standard idio