all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: evaluation context in call statements
Date: Mon, 1 Jul 2013 15:52:31 +0200	[thread overview]
Message-ID: <CALn3zojk74M4SQ65XmC_ckCWkpD0ZMJS9ONC6c7y7V3eqoVuLQ@mail.gmail.com> (raw)
In-Reply-To: <87hagejug8.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

Hi Eric

On Mon, Jul 1, 2013 at 3:11 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> The export function (used by `org-test-with-expanded-babel-code') hadn't
> been updated to use call line names.  I've just pushed up a fix.

Thanks, attached the adapted patch to have my ERT again testing.

Michael

[-- Attachment #2: 0001-Babel-use-NAME-for-src-block-calls-in-ERT.patch.txt --]
[-- Type: text/plain, Size: 5966 bytes --]

From 22633dd583f2a6270bff4e28eed81f1f0d6a36f5 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Mon, 1 Jul 2013 15:50:15 +0200
Subject: [PATCH] Babel: use NAME for src block calls in ERT

* testing/examples/babel.org(use case of reading entry properties):
Adapt to use the new introduced #+NAME for src block calls.
* testing/lisp/test-ob-exp.el(ob-exp/use-case-of-reading-entry-properties):
Adapt to use the new introduced #+NAME for src block calls.
---
 testing/examples/babel.org  | 42 ++++++++++++++++++++++++++++--------------
 testing/lisp/test-ob-exp.el | 13 ++++++-------
 2 files changed, 34 insertions(+), 21 deletions(-)

diff --git a/testing/examples/babel.org b/testing/examples/babel.org
index de1980e..b1f1702 100644
--- a/testing/examples/babel.org
+++ b/testing/examples/babel.org
@@ -365,7 +365,10 @@ Here is a call line with more than just the results exported.
   :ID:       cc5fbc20-bca5-437a-a7b8-2b4d7a03f820
   :END:
 
-If overriden by caller then use :var from header else use entry property.
+Use case checked and documented with this test: During their
+evaluation the source blocks read values from properties from the
+entry where the call has been made unless the value is overridden with
+the optional argument of the caller.
 
 ** section
    :PROPERTIES:
@@ -375,10 +378,14 @@ If overriden by caller then use :var from header else use entry property.
 
 Note: Just export of a property can be done with a macro: {{{property(a)}}}.
 
-#+CALL: src_block_location_shell(dummy_name="sect call")
-#+CALL: src_block_location_elisp[:session sect call]()
-- sect inline call_src_block_location_shell(dummy_name="sect inline")
-- sect inline call_src_block_location_elisp[:session sect inline]()
+#+NAME: src_block_location_shell sect call
+#+CALL: src_block_location_shell()
+
+#+NAME: src_block_location_elisp sect call
+#+CALL: src_block_location_elisp()
+
+- sect inline call_src_block_location_shell()
+- sect inline call_src_block_location_elisp()
 
 *** subsection
     :PROPERTIES:
@@ -386,20 +393,27 @@ Note: Just export of a property can be done with a macro: {{{property(a)}}}.
     :c:        4
     :END:
 
-#+CALL: src_block_location_shell(dummy_name="sub0 call")
-#+CALL: src_block_location_elisp[:session sub0 call]()
-- sub0 inline call_src_block_location_shell(dummy_name="sub0 inline")
-- sub0 inline call_src_block_location_elisp[:session sub0 inline]()
+#+NAME: src_block_location_shell sub0 call
+#+CALL: src_block_location_shell()
+
+#+NAME: src_block_location_elisp sub0 call
+#+CALL: src_block_location_elisp()
+
+- sub0 inline call_src_block_location_shell()
+- sub0 inline call_src_block_location_elisp()
+
+#+NAME: src_block_location_shell sub1 call
+#+CALL: src_block_location_shell(c=5, e=6)
+
+#+NAME: src_block_location_elisp sub1 call
+#+CALL: src_block_location_elisp(c=5, e=6)
 
-#+CALL: src_block_location_shell(dummy_name="sub1 call", c=5, e=6)
-#+CALL: src_block_location_elisp[:session sub1 call](c=5, e=6)
-- sub1 inline call_src_block_location_shell(dummy_name="sub1 inline", c=5, e=6)
-- sub1 inline call_src_block_location_elisp[:session sub1 inline](c=5, e=6)
+- sub1 inline call_src_block_location_shell(c=5, e=6)
+- sub1 inline call_src_block_location_elisp(c=5, e=6)
 
 **** function definition
 
 #+NAME: src_block_location_shell
-#+HEADER: :var dummy_name="workaround to get different result blocks"
 #+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
 #+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
 #+HEADER: :var c=(or (org-entry-get org-babel-current-src-block-location "c" t) "0")
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 416e229..d2541d3 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -217,7 +217,6 @@ Here is one at the end of a line. =2=
       (should-not (string-match (regexp-quote "i=\"10\"") result)))))
 
 (ert-deftest ob-exp/use-case-of-reading-entry-properties ()
-  :expected-result :failed ;; TODO: update for new call line result insertion
   (org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
     (org-narrow-to-subtree)
     (let* ((case-fold-search nil)
@@ -227,27 +226,27 @@ Here is one at the end of a line. =2=
 	   (sub1 "a:1, b:2, c:5, d:0, e:6")
 	   (func sub0))
       ;; entry "section"
-      (should (string-match (concat "\"sect call\".*)\n: shell " sect "\n")
+      (should (string-match (concat "_shell sect call\n: shell " sect "\n")
 			    result))
-      (should (string-match (concat "sect call\\](.*)\n: elisp " sect "\n")
+      (should (string-match (concat "_elisp sect call\n: elisp " sect "\n")
 			    result))
       (should (string-match (concat "\n- sect inline =shell " sect "=\n")
 			    result))
       (should (string-match (concat "\n- sect inline =elisp " sect "=\n")
 			    result))
       ;; entry "subsection", call without arguments
-      (should (string-match (concat "\"sub0 call\".*)\n: shell " sub0 "\n")
+      (should (string-match (concat "_shell sub0 call\n: shell " sub0 "\n")
 			    result))
-      (should (string-match (concat "sub0 call\\](.*)\n: elisp " sub0 "\n")
+      (should (string-match (concat "_elisp sub0 call\n: elisp " sub0 "\n")
 			    result))
       (should (string-match (concat "\n- sub0 inline =shell " sub0 "=\n")
 			    result))
       (should (string-match (concat "\n- sub0 inline =elisp " sub0 "=\n")
 			    result))
       ;; entry "subsection", call with arguments
-      (should (string-match (concat "\"sub1 call\".*)\n: shell " sub1 "\n")
+      (should (string-match (concat "_shell sub1 call\n: shell " sub1 "\n")
 			    result))
-      (should (string-match (concat "sub1 call\\](.*)\n: elisp " sub1 "\n")
+      (should (string-match (concat "_elisp sub1 call\n: elisp " sub1 "\n")
 			    result))
       (should (string-match (concat "\n- sub1 inline =shell " sub1 "=\n")
 			    result))
-- 
1.8.3


  reply	other threads:[~2013-07-01 13:52 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25 17:34 evaluation context in call statements Rick Frankel
2013-06-25 19:21 ` Achim Gratz
2013-06-25 19:53   ` Achim Gratz
2013-06-25 20:06     ` Achim Gratz
2013-06-25 20:07     ` Michael Brand
2013-06-25 20:20       ` Achim Gratz
2013-06-25 20:55         ` Achim Gratz
2013-06-25 22:41         ` Eric Schulte
2013-06-26  6:29           ` Achim Gratz
2013-06-26 14:38             ` Rick Frankel
2013-06-26 15:13               ` Nicolas Goaziou
2013-06-26 15:29                 ` Rick Frankel
2013-06-26 15:49                   ` Eric Schulte
2013-06-26 15:06             ` Eric Schulte
2013-06-27  4:55               ` Achim Gratz
2013-06-27  6:22                 ` Andreas Leha
2013-06-27 14:27                   ` Achim Gratz
2013-06-27 23:12                     ` Andreas Leha
2013-06-30 22:24                 ` Eric Schulte
2013-07-01 10:23                   ` Michael Brand
2013-07-01 13:11                     ` Eric Schulte
2013-07-01 13:52                       ` Michael Brand [this message]
2013-07-01 14:10                         ` Eric Schulte
2013-06-26  8:38           ` Michael Brand
2013-06-26 14:54             ` Eric Schulte
2013-06-26 16:53               ` Michael Brand
2013-06-26 17:11                 ` 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

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

  git send-email \
    --in-reply-to=CALn3zojk74M4SQ65XmC_ckCWkpD0ZMJS9ONC6c7y7V3eqoVuLQ@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.