Piers Cawley ([EMAIL PROTECTED]) wrote:
> Adam Spiers <[EMAIL PROTECTED]> writes:
> You're assuming here that file/line is meaningful, which isn't
> necessarily the case in dynamically generated code. (Like, oooh, inner
> classes...) And there's nothing to stop us collecting that information
> anyway. 

True.

> I'm not sure what you mean by your (b). There's no guaranteed method
> of parsing back to the beginning of the appropriate test_* method so
> if you want to get the whole method you end up having to do
> scattershot methods to increase the amount of context grabbed.

That's right.  I was thinking you could just do something like spawn
"less +$line $file", and then leave the user to choose what to look at.

> '1e1' eq '10'; # ''
> '1e1' == '10'; # 1

Sure, but:

  sub equal {
    my ($a, $b) = @_;
    return $a eq $b;
  }

  print equal('1e1', '10') ? 'equal' : 'not equal', "\n";
  print equal( 1e1  , 10 ) ? 'equal' : 'not equal', "\n";

does the right thing.

>      $str_match = sub { $_[0] eq $_[1] or die "Expected $_[0], got $_[1]\n" }
>      $numeric = sub { $_[0] == $_[1] or die "Expected $_[0], got $_[1]\n" }
> 
>      $self->assert($str_match, "Foo", "Bar");
>      $self->assert($numeric, 10, 11);
> 
> Simple, functional, doesn't add any more methods to Test::Unit::Assert
> and friends. Which is nice.

Ahhhh.  Now that *is* nice.  You should have shown it earlier - it
persuaded me almost instantly :-)  Somehow the previous discussion on
this topic gave me the impression that the interface would be a lot
more complicated.

So, this system has my vote.  I have a few minor concerns which I
would like to see sorted out first though.

Firstly:

$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib 
-I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503 -e 'use Test::Harness 
qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/all_tests.........(This error is expected) Suite class Test::Unit::tests::AllTests 
not found: Can't load '/usr/lib/perl5/5.00503/i386-linux/auto/B/B.so' for module B: 
/usr/lib/perl5/5.00503/i386-linux/auto/B/B.so: undefined symbol: Perl_byterun at 
/usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169.

 at /usr/lib/perl5/5.00503/i386-linux/B/Deparse.pm line 11
BEGIN failed--compilation aborted at /usr/lib/perl5/5.00503/i386-linux/B/Deparse.pm 
line 11.
BEGIN failed--compilation aborted at lib/Test/Unit/Assertion/CodeRef.pm line 10.
BEGIN failed--compilation aborted at lib/Test/Unit/tests/AllTests.pm line 5.
dubious
        Test returned status 2 (wstat 512, 0x200)
Undefined subroutine &Test::Harness::WCOREDUMP called at 
/usr/lib/perl5/5.00503/Test/Harness.pm line 288.
make: *** [test_dynamic] Error 2


I suspect this is due to my system having an old, default RedHat (and
hence broken) rpm of Perl.  Nevertheless, for various unavoidable
reasons, PerlUnit is not much use to me right now unless it works with
this rpm.  There may even be people who would like to use PerlUnit
with perls old enough that they don't have B::Deparse in the core
distribution.  Can it be tweaked to load B::Deparse on demand?  I'd
like to see an example of B::Deparse in action before I'm convinced of
its usefulness.  (There should maybe be some way of choosing its
options via the runner?  Thread merge ...)

Secondly, how would an assertion using

>      $str_match = sub { $_[0] eq $_[1] or die "Expected $_[0], got $_[1]\n" }
>      $numeric = sub { $_[0] == $_[1] or die "Expected $_[0], got $_[1]\n" }

distinguish between an exception raised within a test_method
(e.g. die() if loading of fixture failed) and a failure?

Finally, various minor coding issues:

  - Bits of pod need updating/writing to reflect the changes.

  - T::U::Assertion and T::U::Assert both seem to be missing a

      use Test::Unit::ExceptionFailure

    line, and they duplicate the fail() method.  Do we need both
    classes?

_______________________________________________
Perlunit-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/perlunit-devel

Reply via email to