From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: Re: [PATCH] org-babel-goto-named-src-block bugfix and test Date: Tue, 14 Jun 2016 12:36:51 +0200 Message-ID: <84y468vyyk.fsf@gmail.com> References: <84bn36k8ro.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCliY-0004cH-QR for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 06:37:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCliT-0006nr-QI for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 06:37:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:45094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCliT-0006nn-JL for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 06:37:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bCliS-0004GX-DQ for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 12:37:04 +0200 Received: from x4d02db94.dyn.telefonica.de ([77.2.219.148]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2016 12:37:04 +0200 Received: from marcowahlsoft by x4d02db94.dyn.telefonica.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2016 12:37:04 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org >>> The test uses lines like: >>> >>> (execute-kbd-macro "\M-xorg-babel-goto-named-src-block\n\n") >>> >>> to emulate interactive usage. >>> >>> This feels like a hack, and the messages generated spill into my >>> *shell* buffer when I run `make test'. If there is a cleaner way to >>> do this, I'd like to know it. >>> >>> WDYT? >> >> Why not just use e.g. >> >> (org-babel-goto-named-src-block "def") >> > > Because that does not test the `(interactive ...)' form, which > comprises most of the code in `org-babel-goto-named-src-block'. Okay. I have no idea for a cleaner implementation of these tests. AFAICS these tests look good (and also your code.) If someone has a better idea for the tests they can be changed. I would drop test #v+ ;; non-existent name (should-not (execute-kbd-macro "\M-xorg-babel-goto-named-src-block\ndef\n")) #v- because its outcome has nothing to do with the existence of the name "def" AFAICS. Or maybe replace with (should (string= "source-code block `non-existent' not found in this buffer" (org-babel-goto-named-src-block "non-existent"))) +1 for commit! Best regards, -- Marco Wahl -- GPG: 0x49010A040A3AE6F2