mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
added a test for the new noweb-ref header argument, passing all tests
* testing/examples/babel.org: Example data for new test. * testing/lisp/test-ob-tangle.el (ob-tangle/no-excessive-id-insertion-on-tangle): Safer to narrow, and less work. (ob-tangle/continued-code-blocks-w-noweb-ref): Testing new :noweb-ref header argument.
This commit is contained in:
parent
8c37281cb6
commit
ff62c5d700
|
@ -174,3 +174,31 @@
|
|||
#+begin_src emacs-lisp :var lst=a-list :results list
|
||||
(reverse lst)
|
||||
#+end_src
|
||||
* using the =:noweb-ref= header argument
|
||||
:PROPERTIES:
|
||||
:ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8a0
|
||||
:END:
|
||||
|
||||
#+begin_src sh :tangle yes :noweb yes :shebang #!/bin/sh
|
||||
<<fullest-disk>>
|
||||
#+end_src
|
||||
|
||||
** query all mounted disks
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
df \
|
||||
#+end_src
|
||||
|
||||
** strip the header row
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|sed '1d' \
|
||||
#+end_src
|
||||
|
||||
** sort by the percent full
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|awk '{print $5 " " $6}'|sort -n |tail -1 \
|
||||
#+end_src
|
||||
|
||||
** extract the mount point
|
||||
#+begin_src sh :noweb-ref fullest-disk
|
||||
|awk '{print $2}'
|
||||
#+end_src
|
||||
|
|
|
@ -49,9 +49,26 @@
|
|||
"Don't add IDs to headings without tangling code blocks."
|
||||
(org-test-at-id "ef06fd7f-012b-4fde-87a2-2ae91504ea7e"
|
||||
(org-babel-next-src-block)
|
||||
(org-narrow-to-subtree)
|
||||
(org-babel-tangle)
|
||||
(should (null (org-id-get)))))
|
||||
|
||||
(ert-deftest ob-tangle/continued-code-blocks-w-noweb-ref ()
|
||||
"Test that the :noweb-ref header argument is used correctly."
|
||||
(org-test-at-id "54d68d4b-1544-4745-85ab-4f03b3cbd8a0"
|
||||
(let ((tangled "df \\
|
||||
|sed '1d' \\
|
||||
|awk '{print $5 \" \" $6}'|sort -n |tail -1 \\
|
||||
|awk '{print $2}'
|
||||
"))
|
||||
(org-narrow-to-subtree)
|
||||
(org-babel-tangle)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents "babel.sh")
|
||||
(goto-char (point-min))
|
||||
(should (re-search-forward (regexp-quote tangled) nil t)))
|
||||
(delete-file "babel.sh"))))
|
||||
|
||||
(provide 'test-ob-tangle)
|
||||
|
||||
;;; test-ob-tangle.el ends here
|
||||
|
|
Loading…
Reference in a new issue