Subject: | One Minor Test Issue |
In the Test-Pod-Coverage 1.08 test nosymbols.t there are three tests.
The last 2 tests use the Test Harnesses HARNESS_VERBOSE variable the
first of the test assumes that the environment variable HARNESS_VERBOSE
= 0 or is not defined. The last test sets the local test variable
HARNESS_VERBOSE = 1. Both of these these tests are reading from
Nosymbols.pm which is a Pod containing no symbols.
The problem is if a user has the Perl Test::Harness variable
HARNESS_VERBOSE set to 1 then the NO_VERBOSE test fails:
(Test Ran under Windows NT 5.1 with MinGW 3.4.5 and dmake)
E:\usr\cpan\build\Test\Test-Pod-Coverage-1.08>tst
E:\usr\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib\lib', 'blib\arch')" t/*.t
[19:27:31] t/00.load.t .............. # Testing Test::Pod::Coverage 1.08
[19:27:31] t/00.load.t .............. ok 268 ms
[19:27:32] t/all_modules.t .......... ok 342 ms
[19:27:32] t/all_pod_coverage_ok.t .. ok 513 ms
[19:27:32] t/alt_class.t ............ ok 564 ms
[19:27:33] t/nopod.t ................ ok 580 ms
[19:27:34] t/nosymbols.t ............ 1/3
# Failed test 'Handles files with no symbols'
# at t/nosymbols.t line 16.
# STDERR is:
# # Nosymbols: no public symbols defined
#
# not:
#
# as expected
[19:27:34] t/nosymbols.t ............ Failed 1/3 subtests
[19:27:34] t/parms.t ................ ok 533 ms
[19:27:35] t/pod.t .................. ok 361 ms
[19:27:35] t/privates.t ............. ok 575 ms
[19:27:36] t/self.t ................. ok 497 ms
[19:27:36] t/simple.t ............... ok 580 ms
[19:27:37]
Test Summary Report
-------------------
t/nosymbols.t (Wstat: 0 Tests: 3 Failed: 1)
Failed test: 2
Files=11, Tests=23, 6 wallclock secs ( 0.19 usr + 0.03 sys = 0.22 CPU)
Result: FAIL
Failed 1/11 test programs. 1/23 subtests failed.
dmake: Error code 255, while making 'test_dynamic'
If I add the local $ENV{HARNESS_VERBOSE} = 0 if defined
$ENV{HARNESS_VERBOSE}; nosymbols.t as shown below we pass no matter what
the users Perl Environment settings are:
NO_VERBOSE: {
local $ENV{HARNESS_VERBOSE} = 0 if defined $ENV{HARNESS_VERBOSE};
test_out( "ok 1 - Checking Nosymbols" );
pod_coverage_ok( "Nosymbols", "Checking Nosymbols" );
test_test( "Handles files with no symbols" );
}
This is a minor issue but caught me off-guard for some time and then I
realized what the problem was.
Additionally, the line I added may not be the best alternative for
catching this but it works.
Appreciate any feedback on this small problem and perhaps a minor change
should be added to the next version to catch this issue that may catch
others when testing this module.
Attached is the patched nosymbols.t test file.
Thanks for your assistance.
--
Regards,
Pete Armstrong
pete.a64@gmail.com
Subject: | nosymbols.t |
#!perl -T
use strict;
use lib "t";
use Test::More tests => 3;
use Test::Builder::Tester;
BEGIN {
use_ok( 'Test::Pod::Coverage' );
}
NO_VERBOSE: {
local $ENV{HARNESS_VERBOSE} = 0 if defined $ENV{HARNESS_VERBOSE};
test_out( "ok 1 - Checking Nosymbols" );
pod_coverage_ok( "Nosymbols", "Checking Nosymbols" );
test_test( "Handles files with no symbols" );
}
VERBOSE: {
local $ENV{HARNESS_VERBOSE} = 1;
test_out( "ok 1 - Checking Nosymbols" );
test_diag( "Nosymbols: no public symbols defined" );
pod_coverage_ok( "Nosymbols", "Checking Nosymbols" );
test_test( "Handles files with no symbols" );
}