summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/testcover-tests.el
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2017-09-25 13:45:07 -0700
committerGemini Lasswell <gazally@runbox.com>2017-10-08 16:08:49 -0700
commitd79cf638f278e50c22feb53d6ba556f5ce9d7853 (patch)
tree12d79738615603b2afe277bcbf74c19439e4568d /test/lisp/emacs-lisp/testcover-tests.el
parent06e452a57287c797cb96a6d4b45220358daab379 (diff)
downloademacs-d79cf638f278e50c22feb53d6ba556f5ce9d7853.tar.gz
emacs-d79cf638f278e50c22feb53d6ba556f5ce9d7853.tar.bz2
emacs-d79cf638f278e50c22feb53d6ba556f5ce9d7853.zip
Rewrite Testcover's internals, fixing several bugs
* lisp/emacs-lisp/testcover.el: Rewrite the internals of Testcover to analyze instrumented code instead of reinstrumenting it. Use new hooks in Edebug to collect code coverage information at runtime using Edebug's instrumentation. Includes fixes for: (bug#11307) (bug#24509) (bug#24688) (bug#24743) (bug#25316) (bug#25326). (testcover-compose-functions): Remove mapcar. (testcover-start, testcover-this-defun): Analyze code instead of reinstrumenting it. Set edebug-behavior for each definition. (testcover--read, testcover-1value, testcover-reinstrument) (testcover-reinstrument-list, testcover-reinstrument-compose): Deleted. (testcover-after-instrumentation, testcover-init-definition) (testcover-before): New functions. (testcover-enter): Change call signature to match edebug-enter. (testcover-after, testcover-mark): Add handling of 'maybe and 'noreturn. (testcover-analyze-coverage, testcover-analyze-coverage-progn) (testcover-analyze-coverage-edebug-after) (testcover-analyze-coverage-wrapped-form) (testcover-analyze-coverage-wrapped-application) (testcover-analyze-coverage-compose) (testcover-analyze-coverage-backquote) (testcover-analyze-coverage-backquote-form) (testcover-coverage-combine): New functions to analyze instrumented code. * lisp/emacs-lisp/gv.el: Modify edebug-after's gv-expander to instrument in the setter as well as the getter. * test/lisp/emacs-lisp/testcover-tests.el (testcover-tests-run-test-case): Use `edebug-default-enter' instead of `edebug-enter' to detect Edebug invocation during tests. * test/lisp/emacs-lisp/testcover-resources/testcases.el (constants-bug-25316) (customize-defcustom-bug-25326) (1-value-symbol-bug-25316) (quotes-within-backquotes-bug-25316) (backquote-1value-bug-24509) (pcase-bug-24688) (defun-in-backquote-bug-11307-and-24743) (closure-1value-bug) (backquoted-vector-bug-25316) (vector-in-macro-spec-bug-25316) (mapcar-is-not-compose): Remove expected failure tags. (function-with-edebug-spec-bug-25316): Remove expected failure tag and modify expected result. (quoted-backquote): New test. * lisp/textmodes/rst.el: Remove workarounds for bugs in Testcover. (rst-testcover-defcustom): Deleted. * lisp/subr.el (1value): Remove incorrect description of testcover-1value from docstring, replace with description of Testcover's treatment of 1value.
Diffstat (limited to 'test/lisp/emacs-lisp/testcover-tests.el')
-rw-r--r--test/lisp/emacs-lisp/testcover-tests.el12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/lisp/emacs-lisp/testcover-tests.el b/test/lisp/emacs-lisp/testcover-tests.el
index 0f0ee9a5095..2e03488b306 100644
--- a/test/lisp/emacs-lisp/testcover-tests.el
+++ b/test/lisp/emacs-lisp/testcover-tests.el
@@ -124,14 +124,12 @@ arguments for `testcover-start'."
(save-current-buffer
(set-buffer (find-file-noselect tempfile))
;; Fail the test if the debugger tries to become active,
- ;; which will happen if Testcover's reinstrumentation
- ;; leaves an edebug-enter in the code. This will also
- ;; prevent debugging these tests using Edebug.
- (cl-letf (((symbol-function #'edebug-enter)
+ ;; which can happen if Testcover fails to attach itself
+ ;; correctly. Note that this will prevent debugging
+ ;; these tests using Edebug.
+ (cl-letf (((symbol-function #'edebug-default-enter)
(lambda (&rest _args)
- (ert-fail
- (concat "Debugger invoked during test run "
- "(possible edebug-enter not replaced)")))))
+ (ert-fail "Debugger invoked during test run"))))
(dolist (byte-compile '(t nil))
(testcover-tests-unmarkup-region (point-min) (point-max))
(unwind-protect