stevieb has asked for the wisdom of the Perl Monks concerning the following question:
I've got a strange issue that I can't wrap my head around. I'm trying to correct some CPANTesters fails. I have two directories... my actual repo working dir, and an extracted copy of a make dist. What's happening is that when I run one of the tests in the repo dir everything works, but when I change into the dist dir, the exact same test fails (same results using perl, prove and ./Build test).
The test reads t/sample.data file and does some work. I've confirmed that the sample file and the test file are exactly the same:
~/devel $ diff devel-examine-subs/t/02-has.t Devel-Examine-Subs-1.23/t +/02-has.t ~/devel $ ~/devel $ diff devel-examine-subs/t/sample.data Devel-Examine-Subs-1.2 +3/t/sample.data ~/devel $
...as are all of the rest of the files in the directory structures.
In the repo dir:
~/devel/devel-examine-subs $ perl t/02-has.t 1..26 ok 1 - use Devel::Examine::Subs; ok 2 - new() dies with error if file not found ok 3 - has() returns an array ref file exists and text available ...
...and in the dist dir...
~/devel/Devel-Examine-Subs-1.23 $ perl t/02-has.t 1..26 ok 1 - use Devel::Examine::Subs; ok 2 - new() dies with error if file not found Use of uninitialized value in pattern match (m//) at t/02-has.t line 2 +3. not ok 3 - has() returns an array ref file exists and text available # Failed test 'has() returns an array ref file exists and text avail +able' # at t/02-has.t line 23. ...
The test file, up to the first failing test:
#!perl use warnings; use strict; use Test::More tests => 26; use Data::Dumper; BEGIN {#1 use_ok( 'Devel::Examine::Subs' ) || print "Bail out!\n"; } my $des = Devel::Examine::Subs->new({file => 't/sample.data'}); {#2 my $des2 = Devel::Examine::Subs->new(); eval { $des2->has({ file => 'badfile.none'}) }; ok ( $@ =~ /Invalid file supplied/, "new() dies with error if file + not found " ); } {#3 my $des = Devel::Examine::Subs->new(); my $res = $des->has({ file => 't/sample.data', search => 'this' }) +; ok ( $res->[0] =~ '\w+', "has() returns an array ref file exists a +nd text av ailable" ); }
Can someone explain what may be going on here or where I should start looking? I've never experienced this before and I'm at a loss for what I'm missing. The sample file is opening and being read, otherwise my module would die. I've doubly confirmed this by printing out the contents of the file from within the test file.
Thanks,
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exact same unit tests acting differently in separate directories
by stevieb (Canon) on Aug 12, 2015 at 00:48 UTC | |
|
Re: Exact same unit tests acting differently in separate directories
by Anonymous Monk on Aug 12, 2015 at 00:58 UTC | |
by stevieb (Canon) on Aug 12, 2015 at 01:14 UTC |