- use lib
('|"|q.+?)t/lib - 948 distributions. Not all use Test::More, but
But I would still expect a tag for pushing 't/lib' to @INC, not for
Test::More to push to @INC silently, on the grounds that it's easier
to add to @INC than remove from it if it turns out it's undesirable.
For use within distribution tests, I can think of contrived examples
where it would be cause failure or worse (e.g. t/lib/Data/Dumper.pm
contains malicious code). Or perhaps:
Check if some utility module can be loaded; if so, run test
properly, using the full capacity of the module.
Otherwise, use a module with same name, but less functionality in
t/lib, and perform test minus the good bits.
But I don't know of any actual, real-life examples. I can't see any
way of answering this without smoke testing.
Personally, I also use Test::More in circumstances other than testing
a perl distribution. I don't know how widespread that is - those
things are not going to appear on CPAN. For those things, adding t/lib
could cause directories to appear in @INC surprisingly (albeit very
rarely) and I think for such a core module, surprising things should
On 30 January 2014 19:59, Torbjørn Lindahl wrote:
It seems t/lib is a common place to put modules used to support testing, how
about having Test::More push that path to @INC if -d 't/lib' ? It would save
me one , possibly two annoying lines of code in every .t file I write. With
an import tag, ':automiport' or something, it could perhaps require all .pm
files in that dir too/instead?
personally I end up with use lib 't/lib' in 9 of 10 projects.