Skip Menu |

This queue is for tickets about the Test-Class CPAN distribution.

Report information
The Basics
Id: 56385
Status: resolved
Priority: 0/
Queue: Test-Class

People
Owner: ADIE [...] cpan.org
Requestors: ovid [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.34
Fixed in: (no value)



Subject: Unexpected tests in setup should warn with package name
In the process of refactoring some test classes, I saw the following output: [17:32:26] t/001-test-classes.t .............................. 7983/? # expected 0 test(s) in setup, 1 completed [17:32:26] t/001-test-classes.t .............................. 7987/? # expected 0 test(s) in setup, 1 completed [17:32:26] t/001-test-classes.t .............................. 7989/? # expected 0 test(s) in setup, 1 completed It would nice nice if Test::Class reported which package those were in. These tests take a over an hour to run and rerunning them in verbose mode won't be fun (or more likely, locally hacking Test::Class). Cheers, Ovid
I agree. Makes complete sense. Added to do do list. Patches welcome :-)
On Fri Apr 09 07:31:14 2010, ADIE wrote: Show quoted text
> I agree. Makes complete sense. Added to do do list. Patches welcome :-)
Patch attached :) I didn't bump up the version number because I wasn't sure what you'd do with that. Also, is there a public repository available? I'd much prefer to submit patches with 'svn diff' or (heaven!) a git pull request or something like that. In fact, I'd be happy to throw this up on github (or let you do it) to make contributions easier. Cheers, Ovid
Subject: class_name.patch
diff -r -u Test-Class.orig/Changes Test-Class/Changes --- Test-Class.orig/Changes 2010-03-08 07:06:22.000000000 +0100 +++ Test-Class/Changes 2010-04-10 09:56:06.000000000 +0200 @@ -1,5 +1,8 @@ Changes for Perl extension Test-Class +0.?? + - When extra tests are run, now reports class name along with method name. + 0.34 - or the "Abandon ship!" release - Harmonised $VERSION to the same value (Adam Kennedy) - Devel::Symdump has a bug which is really a bug in core and won't be fixed. diff -r -u Test-Class.orig/lib/Test/Class.pm Test-Class/lib/Test/Class.pm --- Test-Class.orig/lib/Test/Class.pm 2010-03-08 07:06:22.000000000 +0100 +++ Test-Class/lib/Test/Class.pm 2010-04-10 09:54:44.000000000 +0200 @@ -265,7 +265,8 @@ _exception_failure($self, $method, $exception, $tests) unless $exception eq ''; } elsif ($num_done > $num_expected) { - $Builder->diag("expected $num_expected test(s) in $method, $num_done completed\n"); + my $class = ref $self; + $Builder->diag("expected $num_expected test(s) in $class\::$method, $num_done completed\n"); } else { until (($Builder->current_test - $num_start) >= $num_expected) { if ($exception ne '') { diff -r -u Test-Class.orig/t/runtests_extra.t Test-Class/t/runtests_extra.t --- Test-Class.orig/t/runtests_extra.t 2010-03-08 07:06:22.000000000 +0100 +++ Test-Class/t/runtests_extra.t 2010-04-10 09:54:36.000000000 +0200 @@ -18,6 +18,6 @@ test_out("ok 1 - expected test"); test_out("ok 2 - extra test"); -test_err("# expected 1 test(s) in extra_test, 2 completed"); +test_err("# expected 1 test(s) in Foo::extra_test, 2 completed"); Foo->runtests; test_test("extra test detected");
Curtis, You fixed this in April last year :-) Adrian