Re: a safer way to use no_plan?

2007-03-04 Thread Eric Wilhelm
# from A. Pagaltzis # on Sunday 04 March 2007 12:42 pm: >* Eric Wilhelm <[EMAIL PROTECTED]> [2007-03-04 08:20]: >> It's a substitute for >> >> use Test::More (0 ? 'no_plan' : (tests => 202)); >> >> ... mostly because I don't like the number of parens in that. > >Uh? > >use Test::More 0 ? 'no_

Re: a safer way to use no_plan?

2007-03-04 Thread A. Pagaltzis
* Eric Wilhelm <[EMAIL PROTECTED]> [2007-03-04 08:20]: > It's a substitute for > > use Test::More (0 ? (no_plan) : (tests => 202)); > > ... mostly because I don't like the number of parens in that. Uh? use Test::More 0 ? 'no_plan' : ( tests => 202 ); -- *AUTOLOAD=*_;sub _{s/(.*)::(.*)/p

Re: a safer way to use no_plan?

2007-03-04 Thread Chris Dolan
On Mar 4, 2007, at 6:33 AM, Dominique Quatravaux wrote: And what if you are running a variable number of tests depending on stuff such as compile-time options, maintainer mode enabled or not, or whatever? It's really not that hard. It's OK to declare a plan at runtime as long as you declare

Re: a safer way to use no_plan?

2007-03-04 Thread Sébastien Aperghis-Tramoni
Dominique Quatravaux wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andy Lester wrote: Good Lord do I get frustrated at the handwringing over test counting. Look, it's simple. You write your tests. You run it through prove. You see how many tests it reports. You add it at the top of

Re: a safer way to use no_plan?

2007-03-04 Thread Eric Wilhelm
# from brian d foy # on Sunday 04 March 2007 10:02 am: >I run into problems where a loop runs fewer iterations than it should >but the test script otherwise runs to completion normally. I typically treat that as a test case. my $counter = 0; for(things(@foos)) { ok($_); $counter++;

Re: a safer way to use no_plan?

2007-03-04 Thread Eric Wilhelm
# from Sébastien Aperghis-Tramoni # on Sunday 04 March 2007 06:19 am: >     use Test::More; > >     my $tests; >     plan tests => $tests; > >     BEGIN { $tests += n } >     # paragraph of code with n tests > >     BEGIN { $tests += m } >     # paragraph of code with m tests Interesting. What i

Re: a safer way to use no_plan?

2007-03-04 Thread Eric Wilhelm
# from Dominique Quatravaux # on Sunday 04 March 2007 04:33 am: >And what if you are running a variable number of tests depending on >stuff such as compile-time options, maintainer mode enabled or not, or >whatever? Even under no_plan, I would say you should use skip() there. --Eric -- "Time fl

Re: a safer way to use no_plan?

2007-03-04 Thread brian d foy
In article <[EMAIL PROTECTED]>, Eric Wilhelm <[EMAIL PROTECTED]> wrote: > At the bottom of a test file: > > {my $finish = 1; END {$finish or die "\n unplanned exit"}}; > > Yeah, you have to remember to put it at the end of the file, but it may > be easier than counting tests. Thoughts? Yo

Re: a safer way to use no_plan?

2007-03-04 Thread Dominique Quatravaux
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Andy Lester wrote: > Good Lord do I get frustrated at the handwringing over test > counting. Look, it's simple. You write your tests. You run it > through prove. You see how many tests it reports. You add it at > the top of the file. Voila! And

Re: Custom extensions to META.yml

2007-03-04 Thread brian d foy
In article <[EMAIL PROTECTED]>, Ricardo SIGNES <[EMAIL PROTECTED]> wrote: > * brian d foy <[EMAIL PROTECTED]> [2007-03-03T13:31:15] > > In article <[EMAIL PROTECTED]>, Ricardo > > SIGNES <[EMAIL PROTECTED]> wrote: > > > extensions: > > > CPAN::Reporter: > > > cc_author: 0 > > > > I th

Re: a safer way to use no_plan?

2007-03-04 Thread Sébastien Aperghis-Tramoni
David Golden wrote: More often, I find myself creating some data structure to define test cases and then: plan tests => $fixed + $tests_per_case * @cases; Once I've defined the basic tests, I'm usually adding cases rather than changing the per-case test count, so the total test count takes ca

Re: a safer way to use no_plan?

2007-03-04 Thread David Golden
On Sunday 04 March 2007 09:40, Shlomi Fish wrote: My solution to this is: Of late, one solution I've used is just Ctrl-A and Ctrl-X in Vim, with some shortcuts: map ,at m` :silent /plan tests =>3w,/`` map ,rt m` :silent /plan tests =>3w,/`` This works well enough for simple test files.

Re: a safer way to use no_plan?

2007-03-04 Thread Nadim Khemir
On Sunday 04 March 2007 09:40, Shlomi Fish wrote: > My solution to this is: >... > What I do is add comments in a small domain-specific language ... >... > # TEST > is ($mystring, "Hello", "String is Hello"); > > # TEST*3 > for my $i (0 .. 2) > { > ok () > } > Wouldn't Test::Block be bet

Re: Unit vs. use case/functional testing

2007-03-04 Thread Adrian Howard
On 2 Mar 2007, at 22:53, James E Keenan wrote: Adrian Howard wrote: [snip] Adrian: How about posting this part on http://perl-qa.yi.org/ index.php/Main_Page? [snip] ObItsAWiki :-) Adrian

Re: a safer way to use no_plan?

2007-03-04 Thread Adrian Howard
On 4 Mar 2007, at 03:40, Matisse Enzer wrote: A tangential comment: The xUnit approach avoids this question of "counting" altogether - you create one or more subroutines whose names begin with 'test', each of which contain one or more assertions such as is_deeply($got, $expected); and th

Re: a safer way to use no_plan?

2007-03-04 Thread Shlomi Fish
On Sunday 04 March 2007, chromatic wrote: > On Saturday 03 March 2007 18:18, Andy Lester wrote: > > Good Lord do I get frustrated at the handwringing over test   > > counting.  Look, it's simple.  You write your tests.  You run it   > > through prove.  You see how many tests it reports.  You add it