From 5edf6e103b961a708ea396eebab9d0ddbd674d33 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 10 Dec 2013 00:33:43 -0700 Subject: [PATCH] exercise inclusion of noweb expansions in caches --- testing/lisp/test-ob.el | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el index e55009e76..9b39d839c 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 <> \" 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 -- 2.11.4.GIT