mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-23 19:49:32 +00:00
test: tests for expanding noweb references
This commit is contained in:
parent
5b7646ce08
commit
b18e0cb117
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user