summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2013-12-10 00:33:43 -0700
committerEric Schulte <schulte.eric@gmail.com>2013-12-10 00:33:43 -0700
commit5edf6e103b961a708ea396eebab9d0ddbd674d33 (patch)
treef102430bd8684fe0f528c320fdb08d7bff985469
parentece429d43eac74275e72a878b304cf435adbf395 (diff)
downloadorg-mode-5edf6e103b961a708ea396eebab9d0ddbd674d33.tar.gz
exercise inclusion of noweb expansions in caches
-rw-r--r--testing/lisp/test-ob.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index e55009e..9b39d83 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1205,6 +1205,38 @@ echo \"$data\"
(should (not (org-babel-one-header-arg-safe-p arg org-babel-safe-header-args))))
(should (not (funcall safe-p (append safe-args unsafe-args))))))
+(ert-deftest test-ob/noweb-expansions-in-cache ()
+ "Test location of header argument evaluation."
+ (let ((noweb-expansions-in-cache-var 0))
+ (org-test-with-temp-text "
+#+name: foo
+#+begin_src emacs-lisp
+ \"I said\"
+#+end_src
+
+#+name: bar
+#+begin_src emacs-lisp :cache yes
+ (setq noweb-expansions-in-cache-var
+ (+ 1 noweb-expansions-in-cache-var))
+ (concat <<foo>> \" check noweb expansions\")
+#+end_src
+"
+ ;; run the second block to create the cache
+ (goto-char (point-min))
+ (re-search-forward (regexp-quote "#+name: bar"))
+ (should (string= "I said check noweb expansions"
+ (org-babel-execute-src-block)))
+ (should (= noweb-expansions-in-cache-var 1))
+ ;; change the value of the first block
+ (goto-char (point-min))
+ (re-search-forward (regexp-quote "said"))
+ (goto-char (match-beginning 0))
+ (insert "haven't ")
+ (re-search-forward (regexp-quote "#+name: bar"))
+ (should (string= "I haven't said check noweb expansions"
+ (org-babel-execute-src-block)))
+ (should (= noweb-expansions-in-cache-var 2)))))
+
(provide 'test-ob)
;;; test-ob ends here