annotate lisp/emacs-lisp/testcover.el @ 63857:fe881431ae4f

*** empty log message ***
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 29 Jun 2005 13:58:00 +0000
parents c77bef56f877
children c04d583fdac9 a1b34dec1104
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
1 ;;;; testcover.el -- Visual code-coverage tool
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
2
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
3 ;; Copyright (C) 2002, 2005 Free Software Foundation, Inc.
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
4
52042
c195b419ef52 Updated contact address.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 50328
diff changeset
5 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
c195b419ef52 Updated contact address.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 50328
diff changeset
6 ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org>
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
7 ;; Keywords: lisp utility
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
8
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
10
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
14 ;; any later version.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
15
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
20
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
25
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
26
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
27 ;;; Commentary:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
28
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
29 ;; * Use `testcover-start' to instrument a Lisp file for coverage testing.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
30 ;; * Use `testcover-mark-all' to add overlay "splotches" to the Lisp file's
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
31 ;; buffer to show where coverage is lacking. Normally, a red splotch
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
32 ;; indicates the form was never evaluated; a brown splotch means it always
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
33 ;; evaluted to the same value.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
34 ;; * Use `testcover-next-mark' (bind it to a key!) to jump to the next spot
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
35 ;; that has a splotch.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
36
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
37 ;; * Basic algorithm: use `edebug' to mark up the function text with
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
38 ;; instrumentation callbacks, then replace edebug's callbacks with ours.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
39 ;; * To show good coverage, we want to see two values for every form, except
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
40 ;; functions that always return the same value and `defconst' variables
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
41 ;; need show only one value for good coverage. To avoid the brown
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
42 ;; splotch, the definitions for constants and 1-valued functions must
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
43 ;; precede the references.
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
44 ;; * Use the macro `1value' in your Lisp code to mark spots where the local
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
45 ;; code environment causes a function or variable to always have the same
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
46 ;; value, but the function or variable is not intrinsically 1-valued.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
47 ;; * Use the macro `noreturn' in your Lisp code to mark function calls that
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
48 ;; never return, because of the local code environment, even though the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
49 ;; function being called is capable of returning in other cases.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
50
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
51 ;; Problems:
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
52 ;; * To detect different values, we store the form's result in a vector and
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
53 ;; compare the next result using `equal'. We don't copy the form's
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
54 ;; result, so if caller alters it (`setcar', etc.) we'll think the next
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
55 ;; call has the same value! Also, equal thinks two strings are the same
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
56 ;; if they differ only in properties.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
57 ;; * Because we have only a "1value" class and no "always nil" class, we have
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
58 ;; to treat as potentially 1-valued any `and' whose last term is 1-valued,
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
59 ;; in case the last term is always nil. Example:
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
60 ;; (and (< (point) 1000) (forward-char 10))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
61 ;; This form always returns nil. Similarly, `or', `if', and `cond' are
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
62 ;; treated as potentially 1-valued if all clauses are, in case those
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
63 ;; values are always nil. Unlike truly 1-valued functions, it is not an
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
64 ;; error if these "potentially" 1-valued forms actually return differing
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
65 ;; values.
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
66
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
67 (require 'edebug)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
68 (provide 'testcover)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
69
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
70
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
71 ;;;==========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
72 ;;; User options
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
73 ;;;==========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
74
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
75 (defgroup testcover nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
76 "Code-coverage tester"
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
77 :group 'lisp
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
78 :prefix "testcover-"
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
79 :version "21.1")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
80
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
81 (defcustom testcover-constants
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
82 '(nil t emacs-build-time emacs-version emacs-major-version
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
83 emacs-minor-version)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
84 "Variables whose values never change. No brown splotch is shown for
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
85 these. This list is quite incomplete!"
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
86 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
87 :type '(repeat variable))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
88
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
89 (defcustom testcover-1value-functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
90 '(backward-char barf-if-buffer-read-only beginning-of-line
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
91 buffer-disable-undo buffer-enable-undo current-global-map
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
92 deactivate-mark delete-backward-char delete-char delete-region ding
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
93 forward-char function* insert insert-and-inherit kill-all-local-variables
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
94 kill-line kill-paragraph kill-region kill-sexp lambda
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
95 minibuffer-complete-and-exit narrow-to-region next-line push-mark
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
96 put-text-property run-hooks set-match-data signal
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
97 substitute-key-definition suppress-keymap undo use-local-map while widen
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
98 yank)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
99 "Functions that always return the same value. No brown splotch is shown
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
100 for these. This list is quite incomplete! Notes: Nobody ever changes the
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
101 current global map. The macro `lambda' is self-evaluating, hence always
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
102 returns the same value (the function it defines may return varying values
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
103 when called)."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
104 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
105 :type 'hook)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
106
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
107 (defcustom testcover-noreturn-functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
108 '(error noreturn throw signal)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
109 "Subset of `testcover-1value-functions' -- these never return. We mark
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
110 them as having returned nil just before calling them."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
111 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
112 :type 'hook)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
113
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
114 (defcustom testcover-compose-functions
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
115 '(+ - * / = append length list make-keymap make-sparse-keymap
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
116 mapcar message propertize replace-regexp-in-string
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
117 run-with-idle-timer set-buffer-modified-p)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
118 "Functions that are 1-valued if all their args are either constants or
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
119 calls to one of the `testcover-1value-functions', so if that's true then no
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
120 brown splotch is shown for these. This list is quite incomplete! Most
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
121 side-effect-free functions should be here."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
122 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
123 :type 'hook)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
124
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
125 (defcustom testcover-progn-functions
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
126 '(define-key fset function goto-char mapc overlay-put progn
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
127 save-current-buffer save-excursion save-match-data
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
128 save-restriction save-selected-window save-window-excursion
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
129 set set-default set-marker-insertion-type setq setq-default
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
130 with-current-buffer with-output-to-temp-buffer with-syntax-table
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
131 with-temp-buffer with-temp-file with-temp-message with-timeout)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
132 "Functions whose return value is the same as their last argument. No
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
133 brown splotch is shown for these if the last argument is a constant or a
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
134 call to one of the `testcover-1value-functions'. This list is probably
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
135 incomplete!"
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
136 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
137 :type 'hook)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
138
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
139 (defcustom testcover-prog1-functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
140 '(prog1 unwind-protect)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
141 "Functions whose return value is the same as their first argument. No
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
142 brown splotch is shown for these if the first argument is a constant or a
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
143 call to one of the `testcover-1value-functions'."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
144 :group 'testcover
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
145 :type 'hook)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
146
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
147 (defcustom testcover-potentially-1value-functions
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
148 '(add-hook and beep or remove-hook unless when)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
149 "Functions that are potentially 1-valued. No brown splotch if actually
62531
c905fcf5e3d9 Specify missing group (and type, if simple) in defcustom.
Juanma Barranquero <lekktu@gmail.com>
parents: 56458
diff changeset
150 1-valued, no error if actually multi-valued."
c905fcf5e3d9 Specify missing group (and type, if simple) in defcustom.
Juanma Barranquero <lekktu@gmail.com>
parents: 56458
diff changeset
151 :group 'testcover)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
152
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
153 (defface testcover-nohits
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
154 '((t (:background "DeepPink2")))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
155 "Face for forms that had no hits during coverage test"
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
156 :group 'testcover)
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
157 ;; backward-compatibility alias
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
158 (put 'testcover-nohits-face 'face-alias 'testcover-nohits)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
159
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
160 (defface testcover-1value
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
161 '((t (:background "Wheat2")))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
162 "Face for forms that always produced the same value during coverage test"
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
163 :group 'testcover)
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
164 ;; backward-compatibility alias
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
165 (put 'testcover-1value-face 'face-alias 'testcover-1value)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
166
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
167
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
168 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
169 ;;; Other variables
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
170 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
171
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
172 (defvar testcover-module-constants nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
173 "Symbols declared with defconst in the last file processed by
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
174 `testcover-start'.")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
175
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
176 (defvar testcover-module-1value-functions nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
177 "Symbols declared with defun in the last file processed by
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
178 `testcover-start', whose functions should always return the same value.")
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
179
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
180 (defvar testcover-module-potentially-1value-functions nil
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
181 "Symbols declared with defun in the last file processed by
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
182 `testcover-start', whose functions might always return the same value.")
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
183
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
184 (defvar testcover-vector nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
185 "Locally bound to coverage vector for function in progress.")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
186
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
187
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
188 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
189 ;;; Add instrumentation to your module
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
190 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
191
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
192 (defun testcover-start (filename &optional byte-compile)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
193 "Uses edebug to instrument all macros and functions in FILENAME, then
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
194 changes the instrumentation from edebug to testcover--much faster, no
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
195 problems with type-ahead or post-command-hook, etc. If BYTE-COMPILE is
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
196 non-nil, byte-compiles each function after instrumenting."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
197 (interactive "f")
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
198 (let ((buf (find-file filename))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
199 (load-read-function 'testcover-read)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
200 (edebug-all-defs t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
201 (setq edebug-form-data nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
202 testcover-module-constants nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
203 testcover-module-1value-functions nil)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
204 (eval-buffer buf))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
205 (when byte-compile
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
206 (dolist (x (reverse edebug-form-data))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
207 (when (fboundp (car x))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
208 (message "Compiling %s..." (car x))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
209 (byte-compile (car x))))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
210
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
211 ;;;###autoload
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
212 (defun testcover-this-defun ()
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
213 "Start coverage on function under point."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
214 (interactive)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
215 (let* ((edebug-all-defs t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
216 (x (symbol-function (eval-defun nil))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
217 (testcover-reinstrument x)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
218 x))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
219
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
220 (defun testcover-read (&optional stream)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
221 "Read a form using edebug, changing edebug callbacks to testcover callbacks."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
222 (let ((x (edebug-read stream)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
223 (testcover-reinstrument x)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
224 x))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
225
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
226 (defun testcover-reinstrument (form)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
227 "Reinstruments FORM to use testcover instead of edebug. This
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
228 function modifies the list that FORM points to. Result is nil if
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
229 FORM should return multiple vlues, t if should always return same
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
230 value, 'maybe if either is acceptable."
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
231 (let ((fun (car-safe form))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
232 id val)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
233 (cond
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
234 ((not fun) ;Atom
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
235 (when (or (not (symbolp form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
236 (memq form testcover-constants)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
237 (memq form testcover-module-constants))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
238 t))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
239 ((consp fun) ;Embedded list
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
240 (testcover-reinstrument fun)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
241 (testcover-reinstrument-list (cdr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
242 nil)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
243 ((or (memq fun testcover-1value-functions)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
244 (memq fun testcover-module-1value-functions))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
245 ;;Should always return same value
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
246 (testcover-reinstrument-list (cdr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
247 t)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
248 ((or (memq fun testcover-potentially-1value-functions)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
249 (memq fun testcover-module-potentially-1value-functions))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
250 ;;Might always return same value
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
251 (testcover-reinstrument-list (cdr form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
252 'maybe)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
253 ((memq fun testcover-progn-functions)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
254 ;;1-valued if last argument is
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
255 (testcover-reinstrument-list (cdr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
256 ((memq fun testcover-prog1-functions)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
257 ;;1-valued if first argument is
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
258 (testcover-reinstrument-list (cddr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
259 (testcover-reinstrument (cadr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
260 ((memq fun testcover-compose-functions)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
261 ;;1-valued if all arguments are. Potentially 1-valued if all
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
262 ;;arguments are either definitely or potentially.
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
263 (testcover-reinstrument-compose (cdr form) 'testcover-reinstrument))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
264 ((eq fun 'edebug-enter)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
265 ;;(edebug-enter 'SYM ARGS #'(lambda nil FORMS))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
266 ;; => (testcover-enter 'SYM #'(lambda nil FORMS))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
267 (setcar form 'testcover-enter)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
268 (setcdr (nthcdr 1 form) (nthcdr 3 form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
269 (let ((testcover-vector (get (cadr (cadr form)) 'edebug-coverage)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
270 (testcover-reinstrument-list (nthcdr 2 (cadr (nth 2 form))))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
271 ((eq fun 'edebug-after)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
272 ;;(edebug-after (edebug-before XXX) YYY FORM)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
273 ;; => (testcover-after YYY FORM), mark XXX as ok-coverage
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
274 (unless (eq (cadr form) 0)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
275 (aset testcover-vector (cadr (cadr form)) 'ok-coverage))
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
276 (setq id (nth 2 form))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
277 (setcdr form (nthcdr 2 form))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
278 (setq val (testcover-reinstrument (nth 2 form)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
279 (if (eq val t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
280 (setcar form 'testcover-1value)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
281 (setcar form 'testcover-after))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
282 (when val
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
283 ;;1-valued or potentially 1-valued
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
284 (aset testcover-vector id '1value))
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
285 (cond
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
286 ((memq (car-safe (nth 2 form)) testcover-noreturn-functions)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
287 ;;This function won't return, so set the value in advance
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
288 ;;(edebug-after (edebug-before XXX) YYY FORM)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
289 ;; => (progn (edebug-after YYY nil) FORM)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
290 (setcar (cdr form) `(,(car form) ,id nil))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
291 (setcar form 'progn)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
292 (aset testcover-vector id '1value)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
293 (setq val t))
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
294 ((eq (car-safe (nth 2 form)) '1value)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
295 ;;This function is always supposed to return the same value
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
296 (setq val t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
297 (aset testcover-vector id '1value)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
298 (setcar form 'testcover-1value)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
299 val)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
300 ((eq fun 'defun)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
301 (setq val (testcover-reinstrument-list (nthcdr 3 form)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
302 (when (eq val t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
303 (push (cadr form) testcover-module-1value-functions))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
304 (when (eq val 'maybe)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
305 (push (cadr form) testcover-module-potentially-1value-functions)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
306 ((memq fun '(defconst defcustom))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
307 ;;Define this symbol as 1-valued
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
308 (push (cadr form) testcover-module-constants)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
309 (testcover-reinstrument-list (cddr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
310 ((memq fun '(dotimes dolist))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
311 ;;Always returns third value from SPEC
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
312 (testcover-reinstrument-list (cddr form))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
313 (setq val (testcover-reinstrument-list (cadr form)))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
314 (if (nth 2 (cadr form))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
315 val
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
316 ;;No third value, always returns nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
317 t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
318 ((memq fun '(let let*))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
319 ;;Special parsing for second argument
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
320 (mapc 'testcover-reinstrument-list (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
321 (testcover-reinstrument-list (cddr form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
322 ((eq fun 'if)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
323 ;;Potentially 1-valued if both THEN and ELSE clauses are
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
324 (testcover-reinstrument (cadr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
325 (let ((then (testcover-reinstrument (nth 2 form)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
326 (else (testcover-reinstrument-list (nthcdr 3 form))))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
327 (and then else 'maybe)))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
328 ((eq fun 'cond)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
329 ;;Potentially 1-valued if all clauses are
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
330 (when (testcover-reinstrument-compose (cdr form)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
331 'testcover-reinstrument-list)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
332 'maybe))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
333 ((eq fun 'condition-case)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
334 ;;Potentially 1-valued if BODYFORM is and all HANDLERS are
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
335 (let ((body (testcover-reinstrument (nth 2 form)))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
336 (errs (testcover-reinstrument-compose
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
337 (mapcar #'cdr (nthcdr 3 form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
338 'testcover-reinstrument-list)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
339 (and body errs 'maybe)))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
340 ((eq fun 'quote)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
341 ;;Don't reinstrument what's inside!
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
342 ;;This doesn't apply within a backquote
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
343 t)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
344 ((eq fun '\`)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
345 ;;Quotes are not special within backquotes
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
346 (let ((testcover-1value-functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
347 (cons 'quote testcover-1value-functions)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
348 (testcover-reinstrument (cadr form))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
349 ((eq fun '\,)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
350 ;;In commas inside backquotes, quotes are special again
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
351 (let ((testcover-1value-functions
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
352 (remq 'quote testcover-1value-functions)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
353 (testcover-reinstrument (cadr form))))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
354 ((eq fun '1value)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
355 ;;Hack - pretend the arg is 1-valued here
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
356 (cond
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
357 ((symbolp (cadr form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
358 ;;A pseudoconstant variable
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
359 t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
360 ((and (eq (car (cadr form)) 'edebug-after)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
361 (symbolp (nth 3 (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
362 ;;Reference to pseudoconstant
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
363 (aset testcover-vector (nth 2 (cadr form)) '1value)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
364 (setcar (cdr form) `(testcover-1value ,(nth 2 (cadr form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
365 ,(nth 3 (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
366 t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
367 (t
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
368 (if (eq (car (cadr form)) 'edebug-after)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
369 (setq id (car (nth 3 (cadr form))))
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
370 (setq id (car (cadr form))))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
371 (let ((testcover-1value-functions
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
372 (cons id testcover-1value-functions)))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
373 (testcover-reinstrument (cadr form))))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
374 ((eq fun 'noreturn)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
375 ;;Hack - pretend the arg has no return
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
376 (cond
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
377 ((symbolp (cadr form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
378 ;;A pseudoconstant variable
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
379 'maybe)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
380 ((and (eq (car (cadr form)) 'edebug-after)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
381 (symbolp (nth 3 (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
382 ;;Reference to pseudoconstant
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
383 (aset testcover-vector (nth 2 (cadr form)) '1value)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
384 (setcar (cdr form) `(progn (testcover-after ,(nth 2 (cadr form)) nil)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
385 ,(nth 3 (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
386 'maybe)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
387 (t
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
388 (if (eq (car (cadr form)) 'edebug-after)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
389 (setq id (car (nth 3 (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
390 (setq id (car (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
391 (let ((testcover-noreturn-functions
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
392 (cons id testcover-noreturn-functions)))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
393 (testcover-reinstrument (cadr form))))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
394 ((and (eq fun 'apply)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
395 (eq (car-safe (cadr form)) 'quote)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
396 (symbolp (cadr (cadr form))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
397 ;;Apply of a constant symbol. Process as 1value or noreturn
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
398 ;;depending on symbol.
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
399 (setq fun (cons (cadr (cadr form)) (cddr form))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
400 val (testcover-reinstrument fun))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
401 (setcdr (cdr form) (cdr fun))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
402 val)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
403 (t ;Some other function or weird thing
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
404 (testcover-reinstrument-list (cdr form))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
405 nil))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
406
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
407 (defun testcover-reinstrument-list (list)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
408 "Reinstruments each form in LIST to use testcover instead of edebug.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
409 This function modifies the forms in LIST. Result is `testcover-reinstrument's
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
410 value for the last form in LIST. If the LIST is empty, its evaluation will
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
411 always be nil, so we return t for 1-valued."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
412 (let ((result t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
413 (while (consp list)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
414 (setq result (testcover-reinstrument (pop list))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
415 result))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
416
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
417 (defun testcover-reinstrument-compose (list fun)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
418 "For a compositional function, the result is 1-valued if all
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
419 arguments are, potentially 1-valued if all arguments are either
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
420 definitely or potentially 1-valued, and multi-valued otherwise.
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
421 FUN should be `testcover-reinstrument' for compositional functions,
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
422 `testcover-reinstrument-list' for clauses in a `cond'."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
423 (let ((result t))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
424 (mapc #'(lambda (x)
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
425 (setq x (funcall fun x))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
426 (cond
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
427 ((eq result t)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
428 (setq result x))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
429 ((eq result 'maybe)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
430 (when (not x)
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
431 (setq result nil)))))
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
432 list)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
433 result))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
434
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
435 (defun testcover-end (buffer)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
436 "Turn off instrumentation of all macros and functions in FILENAME."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
437 (interactive "b")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
438 (let ((buf (find-file-noselect buffer)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
439 (eval-buffer buf t)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
440
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
441
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
442 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
443 ;;; Accumulate coverage data
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
444 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
445
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
446 (defun testcover-enter (testcover-sym testcover-fun)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
447 "Internal function for coverage testing. Invokes TESTCOVER-FUN while
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
448 binding `testcover-vector' to the code-coverage vector for TESTCOVER-SYM
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
449 \(the name of the current function)."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
450 (let ((testcover-vector (get testcover-sym 'edebug-coverage)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
451 (funcall testcover-fun)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
452
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
453 (defun testcover-after (idx val)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
454 "Internal function for coverage testing. Returns VAL after installing it in
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
455 `testcover-vector' at offset IDX."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
456 (cond
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
457 ((eq (aref testcover-vector idx) 'unknown)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
458 (aset testcover-vector idx val))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
459 ((not (equal (aref testcover-vector idx) val))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
460 (aset testcover-vector idx 'ok-coverage)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
461 val)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
462
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
463 (defun testcover-1value (idx val)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
464 "Internal function for coverage testing. Returns VAL after installing it in
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
465 `testcover-vector' at offset IDX. Error if FORM does not always return the
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
466 same value during coverage testing."
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
467 (cond
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
468 ((eq (aref testcover-vector idx) '1value)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
469 (aset testcover-vector idx (cons '1value val)))
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
470 ((not (and (eq (car-safe (aref testcover-vector idx)) '1value)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
471 (equal (cdr (aref testcover-vector idx)) val)))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
472 (error "Value of form marked with `1value' does vary: %s" val)))
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
473 val)
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
474
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
475
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
476
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
477 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
478 ;;; Display the coverage data as color splotches on your code.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
479 ;;;=========================================================================
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
480
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
481 (defun testcover-mark (def)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
482 "Marks one DEF (a function or macro symbol) to highlight its contained forms
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
483 that did not get completely tested during coverage tests.
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
484 A marking with the face `testcover-nohits' (default = red) indicates that the
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
485 form was never evaluated. A marking using the `testcover-1value' face
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
486 \(default = tan) indicates that the form always evaluated to the same value.
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
487 The forms throw, error, and signal are not marked. They do not return and
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
488 would always get a red mark. Some forms that always return the same
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
489 value (e.g., setq of a constant), always get a tan mark that can't be
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
490 eliminated by adding more test cases."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
491 (let* ((data (get def 'edebug))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
492 (def-mark (car data))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
493 (points (nth 2 data))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
494 (len (length points))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
495 (changed (buffer-modified-p))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
496 (coverage (get def 'edebug-coverage))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
497 ov j item)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
498 (or (and def-mark points coverage)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
499 (error "Missing edebug data for function %s" def))
56458
71315b2afe5b Added some additional functions to the `1-valued', `compose', and progn groups.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 53196
diff changeset
500 (when (> len 0)
50328
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
501 (set-buffer (marker-buffer def-mark))
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
502 (mapc 'delete-overlay
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
503 (overlays-in def-mark (+ def-mark (aref points (1- len)) 1)))
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
504 (while (> len 0)
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
505 (setq len (1- len)
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
506 data (aref coverage len))
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
507 (when (and (not (eq data 'ok-coverage))
53196
b3327f1ed9e1 Ensure that forms marked with `1value' actually always return the same value.
Jonathan Yavner <jyavner@member.fsf.org>
parents: 52401
diff changeset
508 (not (eq (car-safe data) '1value))
50328
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
509 (setq j (+ def-mark (aref points len))))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
510 (setq ov (make-overlay (1- j) j))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
511 (overlay-put ov 'face
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
512 (if (memq data '(unknown 1value))
63223
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
513 'testcover-nohits
c77bef56f877 Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Miles Bader <miles@gnu.org>
parents: 62531
diff changeset
514 'testcover-1value))))
50328
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
515 (set-buffer-modified-p changed))))
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
516
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
517 (defun testcover-mark-all (&optional buffer)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
518 "Mark all forms in BUFFER that did not get completley tested during
50328
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
519 coverage tests. This function creates many overlays."
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
520 (interactive "b")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
521 (if buffer
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
522 (switch-to-buffer buffer))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
523 (goto-char 1)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
524 (dolist (x edebug-form-data)
50328
dda666362e84 No error when marking functions whose body just returns a constant. Handle
Jonathan Yavner <jyavner@member.fsf.org>
parents: 47667
diff changeset
525 (if (get (car x) 'edebug)
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
526 (testcover-mark (car x)))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
527
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
528 (defun testcover-unmark-all (buffer)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
529 "Remove all overlays from FILENAME."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
530 (interactive "b")
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
531 (condition-case nil
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
532 (progn
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
533 (set-buffer buffer)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
534 (mapc 'delete-overlay (overlays-in 1 (buffer-size))))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
535 (error nil))) ;Ignore "No such buffer" errors
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
536
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
537 (defun testcover-next-mark ()
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
538 "Moves point to next line in current buffer that has a splotch."
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
539 (interactive)
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
540 (goto-char (next-overlay-change (point)))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
541 (end-of-line))
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
542
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52135
diff changeset
543 ;;; arch-tag: 72324a4a-4a2e-4142-9249-cc56d6757588
47667
96b260e0ff3d New major mode "SES" for spreadsheets.
Jonathan Yavner <jyavner@member.fsf.org>
parents:
diff changeset
544 ;; testcover.el ends here.