develooper Front page | perl.perl5.porters | Postings from June 2013

[perl #118671] t/comp/parser.t loads from installed perl

Thread Previous | Thread Next
Father Chrysostomos via RT
June 28, 2013 19:55
[perl #118671] t/comp/parser.t loads from installed perl
Message ID:
On Fri Jun 28 11:22:57 2013, craigberry wrote:
> Not sure what the right fix is ... maybe move the test that uses
> out of parser.t into a later test that knows where its
>    libraries are?  And/or more aggressively poisoning @INC for the
>    core tests?

The easiest quick fix would be to put:

chdir 't';
{ local @INC = '../lib';

around the test.  But the same thing could happen very easily again when
more tests are added.

Simply moving the test to a new script in t/op/ doesn’t solve the latter

Maybe we do need TEST to pass -Ifoo.  Or change the tests themselves to
have the right @INC value (as most t/op/ tests do with their little
preamble, that t/comp/require.t also has).

Or, as you said, poison @INC, so that attempting to load will
fail loudly.

But I never feel comfortable with tests that sabotage part of perl to
avoid relying on it in a test, because the tests are not testing
anything that would happen in the real world.  t/comp/use.t makes sure
that is not inadvertently loaded (why?).  This has actually
hidden bugs in the past (e.g., ‘no 6’ not working).


Father Chrysostomos

via perlbug:  queue: perl5 status: new

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About