On Sat, Apr 21, 2001 at 05:48:51AM -0400, barries wrote:
> Agreed that's Really Intrusive. But wrappers just don't cut it, there
> are too many current and future test APIs to wrap. There needs to be
> some common point to make the feature work, but all solutions I can
> think of are intrusive. It'd be a very handy feature, though.
How would you like it if Lincoln Stein suddenly said, "Ok, everyone
who writes a test library will have to support the $CGI::Debugging
flag." And then Gisle says, "I've got an $LWP::DefaultTests variable
you all have to support". There's no end.
The simplest solution is to simply have Pod::Tests provide a set of
wrappers for popular test libraries, and documentation on how to wrap
your own if its not in the defaults. That way, the work is mine
(since I generated the problem), and not every test library author's.
The pragmatic argument is that no existing testing library (except
Test::More... eventually) supports a noplan style, so its the only
thing that can be used with Pod::Tests. I don't expect to see any
more libraries of that style in the near future either. I might get
around to retrofitting it onto Test.pm, though.
Finally, you only have to worry about wrappers if you plan to use the
default test name feature, which I'm thinking more and more isn't
worth the trouble.
Here's perhaps a simple compromise.
=for testing foo()
ok(foo(1), 2);
ok(foo(2), 4);
ok(foo(4), 8);
Would produce...
# testing foo()
ok 5
ok 6
not ok 7
# Failed test (Moo.pm at line 54)
# got: 9
# expected: 8
> > Yes, pod2tests would do "use Test::More noplan;" just as soon as I
> > implement it.
>
> I beg that pod2tests should not foist a testing API on the hapless
> coder. It's way to easy to do
>
> =for testing use Test::More noplan ;
>
> if that's what's wanted. It's not worth saving a line of code if the
> cost is constraining the user and having to add code to Pod::Tests to
> handle the inevitable "but I really want to C<use Test::Better;>" cases.
> Small, separate utilities that cooperate make sense to me here.
I have an interface planned for this, its mentioned in the pod2test docs.
pod2test -MTest::More=noplan Foo.pm
It will also understand the "=for testing use ..." syntax. Not sure
which one will take precedence just yet.
But there will be a default testing library and it will be Test::More.
This default should satisfy 80% of all uses and that's what defaults
are for. Hey, that rhymes!
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
The key, my friend, is hash browns.
http://www.goats.com/archive/980402.html