emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] Specified colnames


From: Eric Schulte
Subject: Re: [O] [babel] Specified colnames
Date: Sat, 27 Apr 2013 09:02:24 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

>
> 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 <address@hidden>
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]