diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/test-coverage.html | |
new repository
Diffstat (limited to 'devdocs/elisp/test-coverage.html')
| -rw-r--r-- | devdocs/elisp/test-coverage.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/devdocs/elisp/test-coverage.html b/devdocs/elisp/test-coverage.html new file mode 100644 index 00000000..87eb5703 --- /dev/null +++ b/devdocs/elisp/test-coverage.html @@ -0,0 +1,10 @@ + <h3 class="section">Test Coverage</h3> <p>You can do coverage testing for a file of Lisp code by loading the <code>testcover</code> library and using the command <kbd>M-x testcover-start <span class="key">RET</span> <var>file</var> <span class="key">RET</span></kbd> to instrument the code. Then test your code by calling it one or more times. Then use the command <kbd>M-x testcover-mark-all</kbd> to display colored highlights on the code to show where coverage is insufficient. The command <kbd>M-x testcover-next-mark</kbd> will move point forward to the next highlighted spot. </p> <p>Normally, a red highlight indicates the form was never completely evaluated; a brown highlight means it always evaluated to the same value (meaning there has been little testing of what is done with the result). However, the red highlight is skipped for forms that can’t possibly complete their evaluation, such as <code>error</code>. The brown highlight is skipped for forms that are expected to always evaluate to the same value, such as <code>(setq x 14)</code>. </p> <p>For difficult cases, you can add do-nothing macros to your code to give advice to the test coverage tool. </p> <dl> <dt id="1value">Macro: <strong>1value</strong> <em>form</em> +</dt> <dd><p>Evaluate <var>form</var> and return its value, but inform coverage testing that <var>form</var>’s value should always be the same. </p></dd> +</dl> <dl> <dt id="noreturn">Macro: <strong>noreturn</strong> <em>form</em> +</dt> <dd><p>Evaluate <var>form</var>, informing coverage testing that <var>form</var> should never return. If it ever does return, you get a run-time error. </p></dd> +</dl> <p>Edebug also has a coverage testing feature (see <a href="coverage-testing">Coverage Testing</a>). These features partly duplicate each other, and it would be cleaner to combine them. </p><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> + <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Test-Coverage.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Test-Coverage.html</a> + </p> +</div> |
