Randal L. Schwartz wrote:
>>>>>> "Michael" == Michael G Schwern <[EMAIL PROTECTED]> writes:
> 
> Michael> Adam Kennedy wrote:
>>> Lately I find myself cheating a bit on the test naming as well, by just
>>> calling the testing package t::lib::Test.
>>>
>>> That saves me one entire line :)
> 
> Michael> Relying on . being in @INC makes my feet itch.
> 
> Relying on being called from the parent of t is also a bit dangerous.
> I often cd t, prove -v 01*.t etc.

Without that assumption most tests which use t/lib libraries or any other file 
in the distribution will break.  You have to do more complex things like rely 
on $0 or __FILE__ and that gets into cross-platform path concatenation and 
File::Spec gets dragged in and oh god the burning.

Also prove -l won't be able to find the source's lib directory with the above 
invocation.  -b will work as it searched up the directory tree a few times.

Since tests are normally guaranteed by MakeMaker/Module::Build to run at the 
top of the source directory, and making tests so they can run from any cwd is 
annoying, its discouraged to run tests from anything but the top level 
directory.


> Is there a place to capture assumptions and best practices like this?

Nope, you get to start a page on the wiki!
http://perl-qa.yi.org/

Reply via email to