Skip Menu |

This queue is for tickets about the Test-Most CPAN distribution.

Report information
The Basics
Id: 38090
Status: rejected
Priority: 0/
Queue: Test-Most

People
Owner: ovid [...] cpan.org
Requestors: NUFFIN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Test::use::ok
Test::use::ok is very minimal: BEGIN { use_ok("foo") } becomes use ok "foo"; which is very helpful for people who forget BEGIN. It's fairly popular and not a tricky dep, so I am hoping Test::Most will encourage its adoption by bundling it too (just a dep really). Cheers,
+1 I've been meaning to adopt this technique into Test::More as it solves a nasty little user trap.
On Fri Aug 01 02:34:08 2008, NUFFIN wrote: Show quoted text
> Test::use::ok is very minimal: > > BEGIN { use_ok("foo") } > > becomes > > use ok "foo"; > > which is very helpful for people who forget BEGIN. > > It's fairly popular and not a tricky dep, so I am hoping Test::Most > will encourage its adoption by > bundling it too (just a dep really).
I've tentatively added this, but it's in my git repository and not on the CPAN: http://github.com/Ovid/test--most/tree/master My only problem with Test::use::ok is that what programmers *really* want is this: BEGIN { use_ok $some_module or die } You want failure to "use" a module to be fatal, regardless of whether or not a Test::Most user has asked for 'die' or 'bail' on failure. That's because the test could fail but you could still wind up with partially compiled code in memory and if the first failure isn't noticed, it can be very, very hard to debug. I've had this happen to me and I know others who have had this or complained about it. Thus, I don't think "use ok My::Module" is really what people want, particularly since, unlike the BEGIN variant, they can't add 'or die' to the end. Cheers, Ovid
This will not be included. Instead of: use ok Some::Module; You should just have: use Some::Module; If it fails, your test will still fail and that's what you want (plus, the "use ok" still needs an "or die" at the end). See http://use.perl.org/~Ovid/journal/39859 for more detailed background. Cheers, Ovid