Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel::NYTProf::FileInfo->is_eval not exercised in 'true' case #161

Open
jkeenan opened this issue Apr 22, 2021 · 0 comments
Open

Devel::NYTProf::FileInfo->is_eval not exercised in 'true' case #161

jkeenan opened this issue Apr 22, 2021 · 0 comments

Comments

@jkeenan
Copy link
Collaborator

jkeenan commented Apr 22, 2021

In a pending pull request I extend the coverage which the test suite provides to lib/Devel/NYTProf/FileInfo.pm. As of this pull request, when I run cover (first with trace unset and then with NYTPROF_TEST="trace=5", I get this coverage:

File                                   stmt   bran   cond    sub  total
blib/lib/Devel/NYTProf/FileInfo.pm     94.4   71.8   65.0  100.0   87.6

While all subroutines are exercised, the statement, branch and condition results are much less satisfactory than I would hope. Analysis shows that there is nothing in the existing test suite which exercises the case where Devel::NYTProf::FileInfo->is_eval() returns a true value.

blib/lib/Devel/NYTProf/FileInfo.pm

line  err   stmt   bran   cond    sub   code
1                                       package Devel::NYTProf::FileInfo;    # fid_fileinfo
51    ***     48     50            48   sub is_eval   { shift->[NYTP_FIDi_EVAL_FI()] ? 1 : 0 }

Branches
--------

line  err      %   true  false   branch
----- --- ------ ------ ------   ------
51    ***     50      0     48   +(shift())->[8] ? :

The consequence of this is that there are statements in the following subroutines which are not exercised:

is_file
sibling_evals

So far I have not been able to construct any case for t/13-fileinfo.t where the FileInfo object is a "string eval" -- notwithstanding the fact that there are instances in the test suite where string evals are indeed exercised, e.g.:

t/test22-strevala.t
59:eval($code)->();
60:eval($code)->(); eval($code)->();
61:eval q{
62:    eval($code)->(); eval($code)->();

Does anyone know how to construct a test case in which FileInfo->is_eval returns true?

Thank you very much.
Jim Keenan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant