* bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown
@ 2017-01-17 21:24 Gemini Lasswell
2019-07-27 10:30 ` Lars Ingebrigtsen
2021-02-06 11:29 ` Lars Ingebrigtsen
0 siblings, 2 replies; 3+ messages in thread
From: Gemini Lasswell @ 2017-01-17 21:24 UTC (permalink / raw)
To: 25471
If you use Edebug or Testcover to gather code coverage information on
code which uses the symbol `unknown', you will get incorrect code
coverage results, because Edebug uses `unknown' internally to represent
forms which have never been evaluated under Edebug.
`unknown' is an obvious name for a Lisp symbol and is used in the Emacs
sources in cedet, calc, cus-edit, elint, erc, gnus and several other
places.
For an example of incorrect code coverage, save this function definition
in a file called bug.el:
(defun how-do-i-know-you (name)
(let ((val 'unknown))
(when (equal name "Bob")
(setq val 'known))
val))
And then use:
M-x testcover-start RET bug.el RET
M-: (how-do-i-know-you "Liz") RET
M-x testcover-mark-all RET RET
The result will be red splotches on the last line of how-do-i-know-you
indicating that Testcover thinks it was never executed.
This could be very simply fixed by changing Edebug to use
`edebug-unknown' instead. The other symbols currently used to record
code coverage are `1value' and `ok-coverage', and they could be changed
respectively to `testcover-1value' and `edebug-ok-coverage'. edebug.el
and testcover.el still wouldn't be able to do code coverage on
themselves, but they should then work for everybody else.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown
2017-01-17 21:24 bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown Gemini Lasswell
@ 2019-07-27 10:30 ` Lars Ingebrigtsen
2021-02-06 11:29 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-27 10:30 UTC (permalink / raw)
To: Gemini Lasswell; +Cc: 25471
Gemini Lasswell <gazally@runbox.com> writes:
> If you use Edebug or Testcover to gather code coverage information on
> code which uses the symbol `unknown', you will get incorrect code
> coverage results, because Edebug uses `unknown' internally to represent
> forms which have never been evaluated under Edebug.
I've now fixed this in edebug.el on the trunk.
> For an example of incorrect code coverage, save this function definition
> in a file called bug.el:
>
> (defun how-do-i-know-you (name)
> (let ((val 'unknown))
> (when (equal name "Bob")
> (setq val 'known))
> val))
>
> And then use:
>
> M-x testcover-start RET bug.el RET
> M-: (how-do-i-know-you "Liz") RET
> M-x testcover-mark-all RET RET
However, the testcover case seems to be more complicated. `unknown'
seems straightforward, but there's also `1value' and `maybe' and perhaps
some other symbols that I'm not sure need this or not. `noreturn', for
instance, seems part of the official API and can't be changed... I
think?
I don't use testcover myself. Could you perhaps propose a patch to fix
this?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown
2017-01-17 21:24 bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown Gemini Lasswell
2019-07-27 10:30 ` Lars Ingebrigtsen
@ 2021-02-06 11:29 ` Lars Ingebrigtsen
1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-06 11:29 UTC (permalink / raw)
To: Gemini Lasswell; +Cc: 25471
Gemini Lasswell <gazally@runbox.com> writes:
> This could be very simply fixed by changing Edebug to use
> `edebug-unknown' instead. The other symbols currently used to record
> code coverage are `1value' and `ok-coverage', and they could be changed
> respectively to `testcover-1value' and `edebug-ok-coverage'. edebug.el
> and testcover.el still wouldn't be able to do code coverage on
> themselves, but they should then work for everybody else.
I've now done the renaming in testcover.el in Emacs 28, too, and the
test case seems to work the same as before, so I'm closing this bug
report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-06 11:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 21:24 bug#25471: 26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown Gemini Lasswell
2019-07-27 10:30 ` Lars Ingebrigtsen
2021-02-06 11:29 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).