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

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

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
June 28, 2013 19:55
Subject:
[perl #118671] t/comp/parser.t loads utf8.pm from installed perl
Message ID:
rt-3.6.HEAD-2552-1372449322-1325.118671-15-0@perl.org
On Fri Jun 28 11:22:57 2013, craigberry wrote:
> Not sure what the right fix is ... maybe move the test that uses
>    utf8.pm 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
problem.

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 utf8.pm 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 feature.pm 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
https://rt.perl.org:443/rt3/Ticket/Display.html?id=118671

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About