emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Sebastien Vauban <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] Specified colnames
Date: Sat, 27 Apr 2013 09:02:24 -0600	[thread overview]
Message-ID: <87txms2f0f.fsf@gmail.com> (raw)
In-Reply-To: <86wqrq4u3r.fsf@somewhere.org> (Sebastien Vauban's message of "Thu, 25 Apr 2013 15:28:56 +0200")

>
> 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 <wxhgmqzgwmuf@spammotel.com>
> 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

  reply	other threads:[~2013-04-27 15:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 20:11 [babel] Specified colnames Sebastien Vauban
2013-04-08 16:41 ` Eric Schulte
2013-04-08 19:45   ` Sebastien Vauban
2013-04-08 20:15     ` Eric Schulte
2013-04-08 20:49       ` Sebastien Vauban
2013-04-12 21:42         ` Eric Schulte
2013-04-18 21:25           ` Sebastien Vauban
2013-04-20 10:11             ` Eric Schulte
2013-04-25 13:28               ` Sebastien Vauban
2013-04-27 15:02                 ` Eric Schulte [this message]
2013-04-27 16:06                   ` Sebastien Vauban
2013-04-27 16:47                     ` Eric Schulte

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txms2f0f.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /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/org-mode.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).