all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.