test: tests for expanding noweb references

This commit is contained in:
Eric Schulte 2011-06-28 13:02:16 -07:00
parent 5b7646ce08
commit b18e0cb117
3 changed files with 41 additions and 0 deletions

View File

@ -244,3 +244,29 @@ an = sign.
#+begin_src sh :noweb-ref fullest-disk
|awk '{print $2}'
#+end_src
* resolving sub-trees as references
:PROPERTIES:
:ID: 2409e8ba-7b5f-4678-8888-e48aa02d8cb4
:results: silent
:END:
#+begin_src emacs-lisp :var text=d4faa7b3-072b-4dcf-813c-dd7141c633f3
(length text)
#+end_src
#+begin_src org :noweb yes
<<simple-subtree>>
<<d4faa7b3-072b-4dcf-813c-dd7141c633f3>>
#+end_src
** simple subtree with custom ID
:PROPERTIES:
:CUSTOM_ID: simple-subtree
:END:
this is simple
** simple subtree with global ID
:PROPERTIES:
:ID: d4faa7b3-072b-4dcf-813c-dd7141c633f3
:END:
has length 14

View File

@ -69,6 +69,14 @@
(should (re-search-forward (regexp-quote tangled) nil t)))
(delete-file "babel.sh"))))
(ert-deftest ob-tangle/expand-headers-as-noweb-references ()
"Test that references to headers are expanded during noweb expansion."
(org-test-at-id "2409e8ba-7b5f-4678-8888-e48aa02d8cb4"
(org-babel-next-src-block 2)
(let ((expanded (org-babel-expand-noweb-references)))
(should (string-match (regexp-quote "simple") expanded))
(should (string-match (regexp-quote "length 14") expanded)))))
(provide 'test-ob-tangle)
;;; test-ob-tangle.el ends here

View File

@ -206,6 +206,13 @@
(should(equal '(:result-type . output) (assoc :result-type params)))
(should(equal '(num . 9) (cdr (assoc :var params)))))))
(ert-deftest test-org-babel/parse-header-args ()
(org-test-at-id "2409e8ba-7b5f-4678-8888-e48aa02d8cb4"
(should (string-match (regexp-quote "this is simple")
(org-babel-ref-resolve "simple-subtree")))
(org-babel-next-src-block)
(should (= 14 (org-babel-execute-src-block)))))
(provide 'test-ob)
;;; test-ob ends here