On 20/07/06, Smylers <[EMAIL PROTECTED]> wrote:
Fergal Daly writes:

> On 20/07/06, chromatic <[EMAIL PROTECTED]> wrote:
>
> > On Wednesday 19 July 2006 18:10, Fergal Daly wrote:
> >
> > > > On Thu, Jul 20, 2006 at 12:39:11AM +0100, Fergal Daly wrote:
> > > >
> > > > > Simple question. Given this code:
> > > > >
> > > > > sub foo {
> > > > >   my $thing;
> > > > >   is($thing->x(), "x"); # line 4
> > > > >   is($thing->y(), "y");
> > > > > }
> > >
> > > Whether I add $T::B::L or not, I don't get any useful output. If
> > > you disagree please show me your fixed version.
> >
> > sub foo :TestHelper
> > {
> >         # this was just a typo; it's not part of my fix
> >         my $thing = shift;
> >         is($thing->x(), "x", 'checking x attribute'); # line 4
> >         is($thing->y(), "y", 'checking y attribute');
> > }
>
> Wrong!!

I'm not so sure.

> Funnily enough your fixed version only provides 1 of these, it will
> tell you that the failure was "checking attribute x" and it will also
> point to line 4 (the line where that test runs). If you had
> incremented $T::B::L at the start then it would have pointed to line 9
> where foo() is called and we'd actually have enough info.
>
> So, you got it wrong when I presume you were being careful. If that's
> not a clear demonstration that something could be a whole lot better
> then I don't know what is.

Note also that the :TestHelper attribute has been added to the sub, to
indicate that it's a sub that helps with testing.

See Aristotle's message earlier in the thread for the suggestion of
using that as a less verbose alternative than having to set the level
variable manually.

Yeah, ok, that was dumb but my other point still stands, you can't
make it work with more than 2 levels of sub routines. If foo calls
bar() twice and bar calls is() twice then you need 3 data points and
you've only got 2,

F

Reply via email to