File: testcover.el.html
* Use testcover-start to instrument a Lisp file for coverage testing.
* Use testcover-mark-all to add overlay "splotches" to the Lisp file's
buffer to show where coverage is lacking. Normally, a red splotch
indicates the form was never evaluated; a brown splotch means it always
evaluated to the same value.
* Use testcover-next-mark (bind it to a key!) to jump to the next spot
that has a splotch.
* Basic algorithm: use edebug to mark up the function text with
instrumentation callbacks, walk the instrumented code looking for
forms which don't return or always return the same value, then use
Edebug's before and after hooks to replace its code coverage with ours.
* To show good coverage, we want to see two values for every form, except
functions that always return the same value and defconst variables
need show only one value for good coverage. To avoid the brown
splotch, the definitions for constants and 1-valued functions must
precede the references.
* Use the macro 1value in your Lisp code to mark spots where the local
code environment causes a function or variable to always have the same
value, but the function or variable is not intrinsically 1-valued.
* Use the macro noreturn in your Lisp code to mark function calls that
never return, because of the local code environment, even though the
function being called is capable of returning in other cases.
Problems:
* equal, which is used to compare the results of repeatedly executing
a form, has a couple of shortcomings. It considers strings to be the same
if they only differ in properties, and it raises an error when asked to
compare circular lists.
* Because we have only a "1value" class and no "always nil" class, we have
to treat as potentially 1-valued any and whose last term is 1-valued,
in case the last term is always nil. Example:
(and (< (point) 1000) (forward-char 10))
This form always returns nil. Similarly, or, if, and cond are
treated as potentially 1-valued if all clauses are, in case those
values are always nil. Unlike truly 1-valued functions, it is not an
error if these "potentially" 1-valued forms actually return differing
values.
Defined variables (11)
testcover-1value-functions | Functions that always return the same value, according to ‘equal’. |
testcover-compose-functions | Functions that are 1-valued if all their args are either constants or |
testcover-constants | Variables whose values never change. |
testcover-module-1value-functions | Symbols declared with defun in the last file processed by |
testcover-module-constants | Symbols declared with defconst in the last file processed by ‘testcover-start’. |
testcover-module-potentially-1value-functions | Symbols declared with defun in the last file processed by |
testcover-noreturn-functions | Subset of ‘testcover-1value-functions’ -- these never return. |
testcover-potentially-1value-functions | Functions that are potentially 1-valued. |
testcover-prog1-functions | Functions whose return value is the same as their first argument. |
testcover-progn-functions | Functions whose return value is the same as their last argument. |
testcover-vector | Locally bound to coverage vector for function in progress. |
Defined functions (23)
testcover--copy-object | (OBJ) |
testcover--copy-object1 | (OBJ VECP HASH-TABLE) |
testcover-after | (BEFORE-INDEX AFTER-INDEX VALUE) |
testcover-after-instrumentation | (FORM) |
testcover-analyze-coverage | (FORM) |
testcover-analyze-coverage-backquote | (BQ-LIST) |
testcover-analyze-coverage-backquote-form | (FORM) |
testcover-analyze-coverage-compose | (FORMS FUNC) |
testcover-analyze-coverage-edebug-after | (FORM BEFORE-FORM BEFORE-ID AFTER-ID WRAPPED-FORM &optional WRAPPER) |
testcover-analyze-coverage-progn | (FORMS) |
testcover-analyze-coverage-wrapped-application | (FUNC ARGS) |
testcover-analyze-coverage-wrapped-form | (FORM) |
testcover-before | (BEFORE-INDEX) |
testcover-coverage-combine | (RESULT VAL) |
testcover-end | (FILENAME) |
testcover-enter | (FUNC ARGS BODY) |
testcover-init-definition | (SYM) |
testcover-mark | (DEF) |
testcover-mark-all | (&optional BUFFER) |
testcover-next-mark | () |
testcover-start | (FILENAME &optional BYTE-COMPILE) |
testcover-this-defun | () |
testcover-unmark-all | (BUFFER) |
Defined faces (2)
testcover-1value | Face for forms that always produced the same value during coverage test. |
testcover-nohits | Face for forms that had no hits during coverage test. |