From: Gemini Lasswell <gazally@runbox.com>
To: 25351@debbugs.gnu.org
Subject: bug#25351: 26.0.50; Testcover doesn't work on code that creates simple lists and modifies them
Date: Tue, 03 Jan 2017 19:06:17 -0800 [thread overview]
Message-ID: <m2inpvr0ba.fsf@rainbow.local> (raw)
Testcover marks forms which have only returned a single value while under
code coverage with a tan splotch to indicate insufficient test coverage,
It also identifies forms which will only ever return a single value and
suppresses the splotch on those. During the coverage run, it saves a
reference to the return value of those single value forms, and the next
time the form is evaluated, it uses `equal' to determine if the value
has changed, and if it has, Testcover reports an error.
The problem with this is that it is a common idiom to create a data
structure using an expression that always returns the same thing, and
then modify it later. Since Testcover keeps a reference not a copy, it
ends up with a reference to a modified object, which fails the
comparison with the next return value of the same expression.
For example:
(defun my-blank-record ()
(list (list 'name) (list 'age)))
(defun my-make-record (name age)
(let ((rec (my-blank-record)))
(setf (cdr (assq 'name rec)) name)
(setf (cdr (assq 'age rec)) age)
rec))
(my-make-record "Jack" 10)
(my-make-record "Jill" 12)
To reproduce this problem, save the above code in a file called bug.el,
and then:
M-x testcover-start RET bug.el RET
The result will be testcover-1value's "Value of form marked with
‘1value’ does vary" error.
next reply other threads:[~2017-01-04 3:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-04 3:06 Gemini Lasswell [this message]
2017-09-26 21:04 ` bug#25351: Patch for bug#25351: 26.0.50; Testcover doesn't work on code that creates simple lists and modifies them Gemini Lasswell
2017-10-08 23:53 ` Gemini Lasswell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2inpvr0ba.fsf@rainbow.local \
--to=gazally@runbox.com \
--cc=25351@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).