From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Merten Newsgroups: gmane.emacs.devel Subject: testcover: setf-method and treatment of `defcustom' Date: Mon, 10 Sep 2012 09:11:42 +0200 Message-ID: <6900.1347261102@theowa.merten-home.homelinux.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1347303813 3568 80.91.229.3 (10 Sep 2012 19:03:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Sep 2012 19:03:33 +0000 (UTC) Cc: Jonathan Yavner To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 10 21:03:36 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TB9Gh-0004nV-PS for ged-emacs-devel@m.gmane.org; Mon, 10 Sep 2012 21:03:36 +0200 Original-Received: from localhost ([::1]:52283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB9Ge-0002Zk-CV for ged-emacs-devel@m.gmane.org; Mon, 10 Sep 2012 15:03:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB9GV-0002ZM-HQ for emacs-devel@gnu.org; Mon, 10 Sep 2012 15:03:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB9GO-0002vt-Sk for emacs-devel@gnu.org; Mon, 10 Sep 2012 15:03:23 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.9]:50582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB9GO-0002s1-Ho for emacs-devel@gnu.org; Mon, 10 Sep 2012 15:03:16 -0400 Original-Received: from theowa.merten-home.homelinux.org (ip-109-46-41-198.web.vodafone.de [109.46.41.198]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0Mch4z-1SttMA2zYX-00IYdU; Mon, 10 Sep 2012 21:03:13 +0200 Original-Received: by theowa.merten-home.homelinux.org (Postfix, from userid 1000) id C57B4400C7; Mon, 10 Sep 2012 09:11:42 +0200 (CEST) Original-Received: from theowa.merten-home.homelinux.org (localhost [127.0.0.1]) by theowa.merten-home.homelinux.org (Postfix) with ESMTP id 9F2F87A007; Mon, 10 Sep 2012 09:11:42 +0200 (CEST) X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.1.1 X-Provags-ID: V02:K0:Dj8TfGF4wrB9xPu7iZyIiCK1RNLU10X+e9lgsJF2UWS cNFUkYKKnkBeYp0XRw3deIAugjXR3jmre8pBE8mzgRQPHinXdQ PRyohh599Wgz0H5lWU8eOV+pSr9u0QKXXZNDZjcemkb5v7ExW8 ykr6VNtAOIo5vJ1Lobh44p60HE7RF9LovDndNQf4ZHmJ5tzomy jMyX1st/MJn23ytobeCaBZ9gIgdaCUZrYRLZjhjFoMsMgYxVfG ogy8f+UluaX1VK+xr8euCbE0KtgKofCzQXGn7DvmbFbjOyswB9 p1fRGlpXS4KiGRzSOAG+XP+1xm8W3z18nfh6Wk25K8gNTroCdo xHnb0pX8AMrDKZRXTZgGCt2lHu6AySaRCSW0yiks/za/xk0joq cPYffs3KWIKkSC06dF/GY/u5uCQqpMj8/k= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153220 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi! I just found the `testcover' package in Emacs 23.1.1 (the source in Emacs 24 changed only very slightly). I tried it with my tests for rst.el and after a lot of investigation got it to work with my `ert' based test suite. I had to solve two problems. When I ran my ert tests some of them fail with No setf-method known for testcover-after I looked into this and found `defsetf' in `cl-macs'. `testcover-after' is a function which has only some side effect. I think (defsetf testcover-after (idx val) (store) (list 'progn (list 'testcover-after idx val) (list 'setf val store))) does the right thing. At least the error messages described above vanish for me. AFAICS the only thing which can go wrong with this setf-method seems to be the double evaluation of `val' - although I don't know whether this really is evaluated twice in this context. Too much macro... I still had another error left, however. Value of form marked with `1value' does vary: ... It took me some time to discover that for some reason `testcover' treats `defcustom' like `defconst'. This is of course lethal for a test which changes a customizable variable temporarily - e.g. by `let' =2D to test a certain functionality. For now I defined (defun rst-defcustom-testcover () "Remove all customized variables from `testcover-module-constants'. This seems to be a bug in `testcover': `defcustom' variables are considered constants. Revert it with this function after each `defcustom= '." (when (boundp 'testcover-module-constants) (setq testcover-module-constants (delq nil (mapcar (lambda (sym) (if (not (plist-member (symbol-plist sym) 'standard-value)) sym)) testcover-module-constants))))) and put a call to this function after every `defcustom'. This helps but IMHO is of selected ugliness. I'd rather suggest this patch (against Emacs 24 sources): --- ../emacs/trunk/lisp/emacs-lisp/testcover.el 2012-04-20 19:50:27.00000= 0000 +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))) In addition it would be certainly helpful to integrate the `defsetf' form above somehow in `testcover'. However, I have no idea how to do this in a good way. Gr=FC=DFe Stefan --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQCVAwUBUE2SqwnTZgC3zSk5AQKlfQQAkSjhBSTiU3g0UaBOpgbb9sgdXhut5O9U 9LzqkYcjG8mtH+1Aa6V5Fuu/4pZQwXXHBS1/WsFQiT/NUS/Z0rpoRfiMB7+sOsf1 E6WhoNO3weZ6MPipQsadCa8NFXp1r4yzHpCT0/d60LCH0hGBj5DVK7XZir8WRfEk 0rvANvU6tLg= =gR17 -----END PGP SIGNATURE----- --=-=-=--