Re: testing darcs with Perl (was: Re: testing non-modules)

2005-03-08 Thread Mark Stosberg
On 2005-03-08, Michael G Schwern <[EMAIL PROTECTED]> wrote: > On Tue, Mar 08, 2005 at 11:33:30AM -0500, Mark Stosberg wrote: >> > I'd make life simpler and dump the shell scripts, see the note about >> > cross-platform compatibility below. >> >> The philosophy behind allowing both is to have a low

Re: testing darcs with Perl (was: Re: testing non-modules)

2005-03-08 Thread Michael G Schwern
On Tue, Mar 08, 2005 at 11:33:30AM -0500, Mark Stosberg wrote: > > I'd make life simpler and dump the shell scripts, see the note about > > cross-platform compatibility below. > > The philosophy behind allowing both is to have a low barrier to entry > for people submitting tests. Better to have te

Re: testing darcs with Perl (was: Re: testing non-modules)

2005-03-08 Thread Mark Stosberg
On Tue, Mar 08, 2005 at 08:23:31AM -0800, Michael G Schwern wrote: > > perl -MTest::Harness -e 'runtests @ARGV' tests/*.pl Aha. Thanks. > Why would you distribute a private copy of Test::Harness? To use 'prove', which your example above illustrates I don't need. > Or do you mean you

Re: testing darcs with Perl (was: Re: testing non-modules)

2005-03-08 Thread Michael G Schwern
On Tue, Mar 08, 2005 at 03:31:37PM +, Mark Stosberg wrote: > Right now the tests are run one at a time, losing the benefit > of the summary report. > > I got stuck trying to think of how to best make this work. > > I don't think I want to use 'Makefile.PL', because the project already > has

testing darcs with Perl (was: Re: testing non-modules)

2005-03-08 Thread Mark Stosberg
I have a fork of the 'testing non-modules' question. :) I help maintain some Perl test scripts for darcs [1]. 1. http://www.darcs.net/ Right now the tests are run one at a time, losing the benefit of the summary report. I got stuck trying to think of how to best make this work

Re: testing non-modules

2005-03-07 Thread Michael G Schwern
On Sun, Mar 06, 2005 at 10:42:53PM -0800, Ofer Nave wrote: > t/Parallel-SimpleUndefined subroutine &main::prun called at > Lastly, how come use_ok( 'Parallel::Simple' ) didn't bitch at me? Because you already have an older version installed which does not have a function called prun()? Sh

Re: testing non-modules

2005-03-07 Thread Johan Vromans
Yitzchak Scott-Thoennes <[EMAIL PROTECTED]> writes: > main() unless caller; I use this (and teach it in my trainings) as an easy way to insert some basic verification tests in modules. At the end of the module: unless ( caller ) { package main; ... insert test code ... } -- Johan

Re: testing non-modules

2005-03-06 Thread Ofer Nave
Yitzchak Scott-Thoennes wrote: I'd make that just: sub main { ...the program using the functions below... } main() unless caller; sub some_function { ... } sub some_other_function { ... } Nice trick. I just tested it. [EMAIL PROTECTED] ~/test] cat foo.pl #!/usr/bin/perl -w use strict; m

Re: testing non-modules

2005-03-06 Thread Yitzchak Scott-Thoennes
On Sun, Mar 06, 2005 at 10:32:26AM -0800, Michael G Schwern wrote: > #!/usr/bin/perl -w > > use Getopt::Long; > > my %Opts; > GetOptions(\%Opts, "test"); > > sub main { > return if $Opts{test}; > > ...the program using the

Re: testing non-modules

2005-03-06 Thread Pete Krawczyk
Subject: Re: testing non-modules From: Johan Vromans <[EMAIL PROTECTED]> To: perl-qa@perl.org }[Quoting Michael G Schwern, on March 6 2005, 10:32, in "Re: testing non-modu"] }> Or if you want to be super portable you can do this: }> }> use Test::Output; }>

Re: testing non-modules

2005-03-06 Thread Johan Vromans
[Quoting Michael G Schwern, on March 6 2005, 10:32, in "Re: testing non-modu"] > Or if you want to be super portable you can do this: > > use Test::Output; > local @ARGV = qw(some args); > stdout_is( sub { do "bin/myprogram" }, 'wibble' ); > > Which has the nice side benefit of

Re: testing non-modules

2005-03-06 Thread Ofer Nave
Michael G Schwern wrote: Now, nobody says this means your program has to be split up into a whole bunch of files and become a full fledged module. You can write something like this. #!/usr/bin/perl -w use Getopt::Long; my %Opts; GetOptions(\%Opts, "test"); s

Re: testing non-modules

2005-03-06 Thread Michael G Schwern
On Sun, Mar 06, 2005 at 09:35:07AM -0800, Ofer Nave wrote: > One issue I've always struggled with is how to properly test code that's > not in the form of a module - in other words, scripts. I use the usual > hacky, temporary methods to test my code as I write it or when I find a > bug (pring s

Re: testing non-modules

2005-03-06 Thread Andy Lester
> One issue I've always struggled with is how to properly test code that's > not in the form of a module - in other words, scripts. I use the usual Take a look at what I do with prove in Test::Harness. It's not very in-depth but should give you a starting point. -- Andy Lester => [EMAIL PRO

testing non-modules

2005-03-06 Thread Ofer Nave
One issue I've always struggled with is how to properly test code that's not in the form of a module - in other words, scripts. I use the usual hacky, temporary methods to test my code as I write it or when I find a bug (pring statements, commenting out things, etc), and occasionally the perl