Re: Test::Most 0.02 (Adds Test::Warn and deferred plans)
Ovid, Are you on the latest version of Test::Deep? Ah, yes. That fixed it. Thanx! There are issues with previous versions having an isa() sub causing strange failures. Yeah, I saw something about that on the list, but it didn't occur to me that having a strange isa() could cause this problem. But that's exactly what it was, so everything is hunky-dory now. Thanx again. -- Buddy
Re: Test::Most 0.02 (Adds Test::Warn and deferred plans)
--- Buddy Burden [EMAIL PROTECTED] wrote: then it works again. Am _I_ doing something wrong here? It seems like some bizarre interaction between Test::Deep and ... well, something. :-) Are you on the latest version of Test::Deep? There are issues with previous versions having an isa() sub causing strange failures. I need to get a new version out upgrading the minimum Test::Deep version. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Personal blog- http://publius-ovidius.livejournal.com/ Tech blog- http://use.perl.org/~Ovid/journal/ Official Perl 6 Wiki - http://www.perlfoundation.org/perl6 Official Parrot Wiki - http://www.perlfoundation.org/parrot
Re: Test::Most 0.02 (Adds Test::Warn and deferred plans)
Ovid, The latter, of course, should assert the number of tests you expected to run, not the number of tests you've actually run. Otherwise, it's not much better than no_plan (except you're still protected from premature exits. Or, to look at it a different way, it would be _exactly_ equivalent to defer_plan and calling all_done() with no args (at least in the current implementation). Thanx for applying the patch Ovid! I can now remove my little intermediate module I had installed to get defer_plan working here at work (which I was cleverly calling Test::Mostest ;- ). -- Buddy
Re: Test::Most 0.02 (Adds Test::Warn and deferred plans)
Ovid, I've just uploaded Test::Most 0.02 to the cpan. Crap ... you fixed that typo. :) I meant to let you know about this, but I got totally distracted before I could pin it down. So now I've got it down fairly sparse here ... create two files: # file: Testit.pm package Testit; use strict; use warnings; use Test::Most qwdie defer_plan; # this is what I _really_ want to do ... #use Test::Most tests = 3; # but it fails just as badly this way too use base qwTest::Builder::Module; our @EXPORT = ( @Test::Most::EXPORT, ); 1; #! /usr/bin/perl # file: test_exports.t use strict; use warnings; use Testit; eval { lives_ok { 1 } 'gets exports from Test::Exception' } or die(); lives_and { ok(1) } 'gets exports from Test::More'; lives_and { eq_or_diff(line1\n, line1\n) } 'gets exports from Test::Differences'; all_done(); Now, running prove test_exports.t gives you: test_exports..Can't call method lives_ok without a package or object reference at test_exports.t line 10. ...propagated at test_exports.t line 10. # Looks like your test died before it could output anything. test_exports.. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 1/1 subtests Test Summary Report --- test_exports.t (Wstat: 65280 Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 1 tests but ran 0. Files=1, Tests=0, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.07 cusr 0.01 csys = 0.10 CPU) Result: FAIL BUT, if you go into Test::Most and comment out line 226, thus changing this: @EXPORT = ( @Test::More::EXPORT, @Test::Differences::EXPORT, @Test::Exception::EXPORT, @Test::Differences::EXPORT, @Test::Deep::EXPORT, @Test::Warn::EXPORT, qw explain restore_fail die_on_fail bail_on_fail all_done ); to this: @EXPORT = ( @Test::More::EXPORT, @Test::Differences::EXPORT, @Test::Exception::EXPORT, @Test::Differences::EXPORT, [EMAIL PROTECTED]::Deep::EXPORT, @Test::Warn::EXPORT, qw explain restore_fail die_on_fail bail_on_fail all_done ); then it works again. Am _I_ doing something wrong here? It seems like some bizarre interaction between Test::Deep and ... well, something. :-) Any thoughts on what could be causing this? -- Buddy
Test::Most 0.02 (Adds Test::Warn and deferred plans)
Hi all, I've just uploaded Test::Most 0.02 to the cpan. Aside from Test::Warn, I've added deferred plans using a patch from barefootcoder++ (Buddy Burden). Example, the following will pass with Test::More 'no_plan': use Test::More 'no_plan'; ok 1; exit; ok 2; You can now guarantee that this will fail: use Test::Most 'defer_plan'; ok 1; exit; ok 2; all_done; Whee! Of course, if knowing the number of tests is an expensive calculation, you can still specify the plan at the end: use Test::Most 'defer_plan'; use My::Tests; my $tests_expected = My::Tests-run; all_done($tests_expected); The latter, of course, should assert the number of tests you expected to run, not the number of tests you've actually run. Otherwise, it's not much better than no_plan (except you're still protected from premature exits. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Personal blog - http://publius-ovidius.livejournal.com/ Tech blog - http://use.perl.org/~Ovid/journal/