unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gemini Lasswell <gazally@runbox.com>
To: 25326@debbugs.gnu.org
Cc: stefan@merten-home.de
Subject: bug#25326: 26.0.50; Testcover error when a defcustom value changed
Date: Sun, 01 Jan 2017 16:29:05 -0800	[thread overview]
Message-ID: <m2lguuqp7y.fsf@rainbow.local> (raw)

Testcover incorrectly marks symbols declared with defcustom as `1value',
which causes it to signal an error if a customizable value is changed
between uses by code under coverage by Testcover.

This is easy to reproduce using the tests for iCalendar. To reproduce,
starting in your Emacs source directory, with emacs -Q if you like:

M-x testcover-start RET lisp/calendar/icalendar.el RET
C-x C-f test/lisp/calendar/icalendar-tests.el RET
M-x eval-buffer RET
M-x ert RET RET

Result: Every test that varies a customization variable fails with the
message "Value of form marked with ‘1value’ does vary"

There was some discussion of this problem on emacs-devel in 2012 under
the title "testcover: setf-method and treatment of `defcustom'"
including a patch to make Testcover treat defcustom like defvar, which
was never applied, as well as mention of pros and cons of fixing it that
way.

I think that it is best to treat defcustom like defvar, which while it
will create more tan splotches on code where behavior under
customization doesn't get tested, it should also encourage people to
write tests that exercise their customization options.

Here's the patch:

  --- ../emacs/trunk/lisp/emacs-lisp/testcover.el       2012-04-20
19:50:27.000000000 +0200
  +++ /home/stefan/tmp/testcover.el     2012-09-10 08:58:01.000000000 +0200
  @@ -297,7 +297,7 @@
          (push (cadr form) testcover-module-1value-functions))
         (when (eq val 'maybe)
          (push (cadr form) testcover-module-potentially-1value-functions)))
  -     ((memq fun '(defconst defcustom))
  +     ((eq fun 'defconst)
         ;;Define this symbol as 1-valued
         (push (cadr form) testcover-module-constants)
         (testcover-reinstrument-list (cddr form)))

If this patch is applied, there is a workaround for this bug in
lisp/textmodes/rst.el which could be removed.





             reply	other threads:[~2017-01-02  0:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02  0:29 Gemini Lasswell [this message]
2017-10-08 23:42 ` bug#25326: 26.0.50; Testcover error when a defcustom value changed 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=m2lguuqp7y.fsf@rainbow.local \
    --to=gazally@runbox.com \
    --cc=25326@debbugs.gnu.org \
    --cc=stefan@merten-home.de \
    /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).