Subject: bug#24402: 25.1.50; testcover-start breaks should-error

From: Gemini Lasswell <[email-masked]>
Date: Fri, 9 Sep 2016 18:26:40 -0700

Enabling code coverage on a file containing an ert test that uses should-error causes the test to fail.

Steps to reproduce:
1. Start emacs (I used: open nextstep/Emacs.app —args -Q)

2. Create a buffer containing the following code and save it as bug.el:
(require 'ert)
(require 'testcover)

(ert-deftest should-error-bug ()
  (should-error (my-error)))

(defun my-error ()
  (/ 1 0))

3. M-x eval-buffer RET

4. M-x ert RET t RET

5. The test passes.

6. M-x testcover-start RET bug.el RET

7. M-x ert RET t RET

8. The test fails. TAB TAB d produced the attached debugger output.

In GNU Emacs 25.1.50.8 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1004))
 of 2016-09-09 built on rainbow.local
Windowing system distributor 'Apple', version 10.3.1404
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
You can run the command ‘eval-buffer’ with M-x ev-b RET
Ran 1 tests, 1 results were as expected
Edebug: test@should-error-bug
Edebug: my-error
You can run the command ‘testcover-start’ with M-x tes-s RET
Edebug: my-error
Ran 1 tests, 0 results were as expected, 1 unexpected

Configured using:
 'configure --with-ns --without-gnutls'

Configured features:
JPEG IMAGEMAGICK NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ERT-Results

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils cl-seq cl-macs testcover edebug
ert pp find-func seq byte-opt gv bytecomp byte-compile cl-extra
help-mode cconv ewoc easymenu debug cl-loaddefs pcase cl-lib time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote kqueue
cocoa ns multi-tty make-network-process emacs)