On 19/07/06, demerphq <[EMAIL PROTECTED]> wrote:
Then i can find the test _easily_. No heurisitics, no BS with poorly
documented vars in Test::Builder. And speaking of
$Test::Builder::Level at me let me ask a question, how many are  going
to read Test::Builder to get the line numbers from tests in Test::More
right? Experience shows not very many people[1]. Heck the variable
isn't even mentioned in Test::More. And Test::Builder isn't mentioned
in Test::Simple at all (presumably because it doesnt use it, in which
case $Test::Builder::Level isnt going to help.)

It doesn't use it because it doesn't need to. By default, it expects
one extra level of stack frame. So something like

package Test::Mine;

my $Test = Test::Builder->new();

sub long_enough {
 # I don't like short strings
  my ($string,  $name) = @_
  $T->ok(length($string) > 10, $name);
}

works without any need to adjust $T::B::L. It's only if you're going
to add further levels of stack frame by doing something like

sub just_right {
  my ($string,  $name) = @_
  local $T::B::L = $T::B::L + 1;
  long_enough($string, $name);
  short_enough($string, $name);
}

that you need to make the adjustment,

F

Reply via email to