Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 80602
Status: new
Priority: 0/
Queue: Test-Base

People
Owner: Nobody in particular
Requestors: NGLENN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.60
Fixed in: (no value)



Subject: PATCH: check for previous tests before running run_compare()
If I understood the documentation correctly here: NOTE: If you do not specify either a plan, or run any tests, the run_compare function will automatically be run. then I assume that running any tests in my file will cause Test::Base to not run run_compare. However, I recently wrote a test file without a plan but with tests, and Test::Base ran run_compare and as a result gave me a bunch of difficult errors ("need two sections in first block"; it's only really a difficult to understand error if you don't know that run_compare is being run). The patch I am attaching checks that no tests have been run before running run_compare(). I am also attaching a MWE to show the bug. Just unzip and run it with `perl -It t/tests.t` and you'll see some errors output by Test::Base. I'm sorry I can't submit a test for this functionality; I haven't the slightest clue on how to check if a function was run without adding another variable as a flag to the it.
Subject: CheckForTests.patch
diff --git a/lib/Test/Base.pm b/lib/Test/Base.pm index fbd1cc2..7dc5ae7 100644 --- a/lib/Test/Base.pm +++ b/lib/Test/Base.pm @@ -290,7 +290,8 @@ sub _assert_plan { } sub END { - run_compare() unless $Have_Plan or $DIED or not $import_called; + my $Test = Test::Builder->new; + run_compare() unless $Test->current_test() != 0 or $Have_Plan or $DIED or not $import_called; } sub run_compare() {
Subject: t.zip
Download t.zip
application/x-zip-compressed 464b

Message body not shown because it is not plain text.