org-mode/testing/examples/babel.org
Eric Schulte ff62c5d700 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.
2011-06-15 21:27:58 -07:00

4 KiB
Raw Blame History

a collection of examples for Babel tests

:noweb header argument expansion

  (message "expanded")
  ;; noweb-yes-start
  <<noweb-example>>
  ;; noweb-yes-end
  ;; noweb-no-start
  <<noweb-example>>
  ;; noweb-no-end
  ;; noweb-tangle-start
  <<noweb-example>>
  ;; noweb-tangle-end

elisp forms in header arguments

  prop
4

excessive id links on tangling

no, don't give me an ID

  (message "not to be tangled")

yes, I'd love an ID

  (message "for tangling")

simple variable resolution

  (list 1 2 3 4)
  (length four)
4

multi-line header arguments

  (map 'list #'list numbers letters)
1 a
2 b
3 c
4 d
5 e
6 f
7 g

simple named code block

  42
42
42

Pascal's Triangle export test

  (defun pascals-triangle (n)
    (if (= n 0)
        (list (list 1))
      (let* ((prev-triangle (pascals-triangle (- n 1)))
             (prev-row (car (reverse prev-triangle))))
        (append prev-triangle
                (list (map 'list #'+
                           (append prev-row '(0))
                           (append '(0) prev-row)))))))

  (pascals-triangle n)

calling code blocks from inside table

  (sqrt n)

executing an lob call line

parsing header arguments

  the body

conflicting blocks on export

  • a
  • b
  • c
    "code block results"
  (reverse lst)

using the :noweb-ref header argument

  <<fullest-disk>>

query all mounted disks

  df \

strip the header row

  |sed '1d' \

sort by the percent full

  |awk '{print $5 " " $6}'|sort -n |tail -1 \

extract the mount point

  |awk '{print $2}'