Skip Menu |

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

Report information
The Basics
Id: 83472
Status: resolved
Priority: 0/
Queue: Test-Compile

People
Owner: Nobody in particular
Requestors: bitcard [...] siteaboutnothing.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.23
Fixed in: (no value)



The test fails if I use all_pm_files_ok and all_pl_files_ok in the same script. This alluded to in the POD ("calls the plan() function for you ... so you can't have already called plan."), but not specifically mentioned. It would be better if we could just call both files in the same script, or failing that, the POD should advise against it. Environment: Test-Compile-0.23 Perl v5.14.2 Linux, 2.6.18-308.8.1.el5 #1 SMP, x86_64 GNU/Linux Script: use Test::Compile; all_pm_files_ok(); all_pl_files_ok(); Output: $ prove -v t/10-env/compile_fails.t t/10-env/compile_fails.t .. 1..2 ok 1 - Compile test for lib/****/xxxxxx.pm ok 2 - Compile test for lib/****/yyyyyy.pm You tried to plan twice at /********/perl5/lib/perl5/Test/Compile.pm line 126. # Looks like your test exited with 255 just after 2. Dubious, test returned 255 (wstat 65280, 0xff00) All 2 subtests passed Test Summary Report ------------------- t/10-env/compile_fails.t (Wstat: 65280 Tests: 2 Failed: 0) Non-zero exit status: 255 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.44 cusr 0.02 csys = 0.49 CPU) Result: FAIL
Subject: Test::Compile is much too fragile
Thank you for your bug report. You are quite right, in fact, I have seen this behaviour too. I also agree with you that that the script isn't really doing the right thing. Unfortunately I can't change the behaviour because it will cause failures where people rely on the existing logic. I will update the POD to specifically advise against trying to use both functions when I get some time. Interestingly, this is the exact problem that caused me to take over maintenance of this module, and my recommendation is to use Test::Compile::Internal. Your script: Show quoted text
> use Test::Compile; > all_pm_files_ok(); > all_pl_files_ok();
Could be changed to: Show quoted text
> use Test::Compile::Internal; > my $test = Test::Compile::Internal->new(); > $test->all_files_ok(); > $test->done_testing();
...and I am pretty sure it'll do what you want. I'll also update the POD to recommend that module more assertively. I hope this helps. -- Evan Giles
I have released Test::Compile (0.24) - which I think makes it clear that you can't call both all_pl_files_ok() & all_pm_files_ok().