From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] Specified colnames Date: Sat, 27 Apr 2013 09:02:24 -0600 Message-ID: <87txms2f0f.fsf@gmail.com> References: <86y5cuxfro.fsf@somewhere.org> <87obdp0ybb.fsf@gmail.com> <86ip3w957l.fsf@somewhere.org> <87fvz0zslt.fsf@gmail.com> <86a9p8928u.fsf@somewhere.org> <871uaffk5g.fsf@gmail.com> <86sj2nv8de.fsf@somewhere.org> <878v4c7pwp.fsf@gmail.com> <86wqrq4u3r.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW6dr-0007t0-0t for emacs-orgmode@gnu.org; Sat, 27 Apr 2013 11:02:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW6dp-0002s8-Rw for emacs-orgmode@gnu.org; Sat, 27 Apr 2013 11:02:22 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:53198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW6dp-0002s3-KS for emacs-orgmode@gnu.org; Sat, 27 Apr 2013 11:02:21 -0400 Received: by mail-pd0-f172.google.com with SMTP id 4so2946248pdd.3 for ; Sat, 27 Apr 2013 08:02:20 -0700 (PDT) In-Reply-To: <86wqrq4u3r.fsf@somewhere.org> (Sebastien Vauban's message of "Thu, 25 Apr 2013 15:28:56 +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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: emacs-orgmode@gnu.org > > Here the patch you asked for. > > Best regards, > Seb > I've applied this patch. Please review the changes I had to make for it to work correctly. Your version wasn't working because when org-babel-execute-src-block was called the point was not inside of the code block. My changes search forward in the text to place the point at the beginning of the code block before executing. I also had to uppercase RESULTS for the string equality to return true. In the future more flexible tests (such as regular expression searches) rather than strict equality should be preferable. Thanks for contributing this test! > > From aa7230ff485df5d9775429b53487aefcc7cd911d Mon Sep 17 00:00:00 2001 > From: Sebastien Vauban > Date: Thu, 25 Apr 2013 15:24:58 +0200 > Subject: [PATCH] Test support of explicitly specified colnames > > * test-ob.el (test-ob/specific-colnames): Add test checking that given column > names are well present in the output table. > > --- > testing/lisp/test-ob.el | 32 ++++++++++++++++++++++++++++++++ > 1 files changed, 32 insertions(+), 0 deletions(-) > > diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el > index bbbfbc4..d51e183 100644 > --- a/testing/lisp/test-ob.el > +++ b/testing/lisp/test-ob.el > @@ -1106,6 +1106,38 @@ Paragraph" > (widen) > (should (should (re-search-forward "^: 3" nil t))))) > > +(ert-deftest test-ob/specific-colnames () > + "Test passing specific column names." > + (should > + (equal "#+name: input-table > +| id | var1 | > +|----+------| > +| 1 | bar | > +| 2 | baz | > + > +#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author) > +echo \"$data\" > +#+end_src > + > +#+results: > +| Rev | Author | > +|-----+--------| > +| 1 | bar | > +| 2 | baz | > + > +" > + (org-test-with-temp-text "#+name: input-table > +| id | var1 | > +|----+------| > +| 1 | bar | > +| 2 | baz | > + > +#+begin_src sh :var data=input-table :exports results :colnames '(Rev Author) > +echo \"$data\" > +#+end_src > +" > + (org-babel-execute-src-block) > + (buffer-string))))) > > (provide 'test-ob) > > -- > 1.7.9 -- Eric Schulte http://cs.unm.edu/~eschulte