* Value results procesing The list of valid =:result= arguments #+BEGIN_SRC elisp :results list (cdr (assoc 'results org-babel-common-header-args-w-values)) #+END_SRC #+results: - (file list vector table scalar verbatim) - (raw html latex org code pp drawer) - (replace silent none append prepend) - (output value) You can add languages to this list to test them as well. The genrator assumes that a double quoted string, with the escapes =\n= and =\t= are valid in the language and that no statement terminator is required. The "method" is the statement required for the value to be returned to the wrapper code. (E.g., none for =perl= and =ruby=, =sh= does not actually return values so needs an =echo=.) #+NAME: languages | language | method | array | |----------+--------+----------------------------| | sh | echo | | | perl | | [[qw[h1 h2]],[qw[r1 r2]]] | | ruby | | [%w[h1 h2],%w[r1 r2]] | | elisp | | '((h1 h2) (r1 r2)) | | python | return | [["h1", "h2"],["r1","r2"]] | ** Generate test code :noexport: #+NAME: block #+BEGIN_SRC elisp :eval never (defun block (lang body function handler type) (format "**** %s body, :results value %s %s ,#+BEGIN_SRC %s :results value %s %s :wrap example %s %s ,#+END_SRC\n" (cond ((not (not (string-match-p "^\"|" body))) "pipe delimited") ((not (not (string-match-p "^\"" body))) "tab delimited") (t "array")) handler type lang handler type function body)) #+END_SRC Run this block to generate the test code. You can then execute the test code by running =org-babel-execute-subtree= on [[*All%20Tests][All Tests]]. The file exports resonably nicely to either HTML or LaTeX. #+HEADER: :var languages=languages #+HEADER: :var types='("" "table" "scalar" "verbatim") #+HEADER: :var formatting='("" "raw") #+HEADER: :var scalar="\"|h1|h2|\\n|-\\n|r1|r2|\"" #+HEADER: :var tab-delim="\"h1\\th2\\t\\nr1\\tr2\"" #+BEGIN_SRC elisp :results raw :noweb yes (require 'ob-perl) (require 'ob-sh) (require 'ob-python) <> (save-excursion (condition-case nil (progn (goto-char (org-find-entry-with-id "ALL-TESTS")) (org-cut-subtree)) (error t))) (concat "* All Tests\n" ":PROPERTIES:\n" ":ID: ALL-TESTS\n" ":END:\n" (mapconcat (lambda (lang) (format "** %s\n%s" (car lang) (mapconcat (lambda (formatter) (format "*** Result format: %s\n%s" (if (string= formatter "") "default" formatter) (mapconcat (lambda (type) (let ((l (car lang)) (pfx (nth 1 lang)) (array (nth 2 lang))) (concat (block l scalar pfx formatter type) (block l tab-delim pfx formatter type) (unless (string= "" array) (block l array pfx formatter type))))) types "\n"))) formatting ""))) languages "")) #+END_SRC