Skip Menu |

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

Report information
The Basics
Id: 126017
Status: open
Priority: 0/
Queue: Test-Trap

People
Owner: Nobody in particular
Requestors: davidp [...] preshweb.co.uk
Cc:
AdminCc:

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



Subject: t/06-layers.t fails if env var PERL5OPT set to -M5.010
I got a test failure in t/06-layers.t - tracked it down to the fact that my environment has PERL5OPT=-M5.010 to automatically enable 5.10+ features. Running without that env var, it passes. Now, one could argue that "that's your environment's fault, then", and I wouldn't necessarily argue with that, but it would be *nice* if the tests could check the environment is as they expect it to be (or make it so) to avoid this. [davidp@supernova:~/tmp/Test-Trap-v0.3.3]$ prove -Ilib t/06-layers.t t/06-layers.t .. 1/163 # Looks like your test exited with 1 just after 101. t/06-layers.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 62/163 subtests Test Summary Report ------------------- t/06-layers.t (Wstat: 256 Tests: 101 Failed: 0) Non-zero exit status: 1 Parse errors: Bad plan. You planned 163 tests but ran 101. Files=1, Tests=101, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.09 cusr 0.00 csys = 0.12 CPU) Result: FAIL [davidp@supernova:~/tmp/Test-Trap-v0.3.3]$ echo $PERL5OPT -M5.010 [davidp@supernova:~/tmp/Test-Trap-v0.3.3]$ PERL5OPT= prove -Ilib t/06-layers.t t/06-layers.t .. ok All tests successful. Files=1, Tests=163, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.09 cusr 0.00 csys = 0.12 CPU) Result: PASS
Subject: Re: [rt.cpan.org #126017] t/06-layers.t fails if env var PERL5OPT set to -M5.010
Date: Tue, 7 Aug 2018 23:18:03 +0200
To: bug-Test-Trap [...] rt.cpan.org
From: The Sidhekin <sidhekin [...] gmail.com>
Funny. It reduces to: eirik@greencat[22:55:58]~$ perl -MTest::Trap=default -e 'default { exit 1 }; print "Got: ", $trap->exit, "\n";' Got: 1 eirik@greencat[22:56:00]~$ PERL5OPT=-M5.010 perl -MTest::Trap=default -e 'default { exit 1 }; print "Got: ", $trap->exit, "\n";' eirik@greencat[22:56:04]~$ ... which simply collides with the reserved(?) word "default" of the "switch" (mis)feature. Yeah, I don't know about letting the tests decide what environment you should run it under. It's your foot, after all; not a CPAN author's business telling you not to shoot it. Sure, maybe I could add something like C<< no if $] > 5.010, 'feature', ':all'; >> to the tests. Ought to catch collisions with new features, at least; other collisions should be obvious, I guess. But that would entail adding a dependency on the "if" pragma, which was released with perl 5.6.2. (Which coincides with what Test-Trap still supports, so maybe that's fair?) And I don't see other CPAN authors adding such future-proofing (feature-proofing?) guards to their test code ... even when they define subs in all-lowercase, ready to collide with new "reserved" words ... ... although that's not an argument, really. (Appeal to tradition?) Maybe CPAN authors ought to guard their use of all-lowercase subs ... I'll sleep on it. Eirik