timbunce / devel-nytprof

Devel::NYTProf is a powerful feature-rich source code profiler for Perl. (Mostly in maintenance mode, so PRs are much more likely to be acted upon than Issues.)
http://blog.timbunce.org/tag/nytprof/
67 stars 51 forks source link

Data coverage 20210331 #151

Closed jkeenan closed 3 years ago

jkeenan commented 3 years ago

This pull request focuses on improvements in test coverage, primarily to lib/Devel/NYTProf/Data.pm. Most new tests are found in t/12-data.t. t/nytprof_11-data.out.txt was cloned to t/nytprof_12-data.out.txt to provide test data for this new test file.

Coverage analysis exposed some code that was duplicative and some that was not needed. Two subroutines in Data.pm have been deactivated by being commented out. They will be deleted altogether in a future release. Those subroutines were:

A search at grep.metacpan.org suggests that these subs have never been used outside this distro.

The definition of helper sub _dumper() was moved from lib/Devel/NYTProf/Data.pm to lib/Devel/NYTProf/Util.pm.

When the test suite is run through Devel::Cover once without a trace level and then once with NYTPROF_TEST=trace=5, coverage grows to:

------------------------------------ ------ ------ ------ ------ ------
File                                   stmt   bran   cond    sub  total
------------------------------------ ------ ------ ------ ------ ------
blib/lib/Devel/NYTProf.pm               0.0    n/a    n/a    0.0    0.0
blib/lib/Devel/NYTProf/Constants.pm    60.0    0.0    n/a   80.0   51.6
blib/lib/Devel/NYTProf/Core.pm        100.0    n/a    n/a  100.0  100.0
blib/lib/Devel/NYTProf/Data.pm         99.3   86.6   80.4  100.0   93.3
blib/lib/Devel/NYTProf/FileInfo.pm     88.1   67.7   60.0   84.7   81.0
blib/lib/Devel/NYTProf/ReadStream.pm  100.0    n/a    n/a  100.0  100.0
blib/lib/Devel/NYTProf/Reader.pm       80.5   51.5   41.0  100.0   67.9
blib/lib/Devel/NYTProf/Run.pm          85.7   35.0   33.3  100.0   68.3
blib/lib/Devel/NYTProf/SubInfo.pm      92.0   72.8   70.2   80.9   83.8
blib/lib/Devel/NYTProf/Test.pm          n/a    n/a    n/a  100.0  100.0
blib/lib/Devel/NYTProf/Util.pm         97.3   80.8   72.7  100.0   91.0
Total                                  90.2   69.5   62.1   91.1   81.9
------------------------------------ ------ ------ ------ ------ ------

(See here for a display of where we started out coverage-wise in release 6.06.)

jkeenan commented 3 years ago

Rebased and merged locally in 84dc795b875b1f6233907211b79e29715534a637. Closing ticket.