From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martyn Jago Subject: Re: [babel] Collection of code block snippets Date: Tue, 06 Sep 2011 16:35:29 +0100 Message-ID: References: <878vq48dvt.fsf@gmail.com> <87zkiiq4ko.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0xgk-0000jh-GP for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 11:35:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0xge-00035p-Ua for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 11:35:50 -0400 Received: from lo.gmane.org ([80.91.229.12]:58384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0xge-00035i-4J for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 11:35:44 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R0xgd-0002S3-F8 for emacs-orgmode@gnu.org; Tue, 06 Sep 2011 17:35:43 +0200 Received: from 88-96-171-142.dsl.zen.co.uk ([88.96.171.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Sep 2011 17:35:43 +0200 Received: from martyn.jago by 88-96-171-142.dsl.zen.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 06 Sep 2011 17:35:43 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Rainer M Krug writes: [...] > >> >> > And if this could be done by the user to test .emacs configuration >> > settings, that would be really great. >> > >> >> That's a good idea. Simply running the Org-mode test suite is a good >> way for users to test the sanity of their local config. >> > > Yes - I have a few times run into problems due to my configuration file and > only realized it later - if there would be ab org file which I could use to > test easily my configuration directly after making the changes, life would > have been much easier for me. This would also be useful for questions on the > mailing list and for a kind of "quality control" for published configs on > the web. In terms of running all the tests in 'batch mode' i.e. loading no personal configuration files (for development purposes), I have put together a small 'test-init.el' file to do that. The emacs command is: --8<---------------cut here---------------start------------->8--- $ /path/to/emacs/Emacs -batch -l /path/to/org/testing/test-init.el --8<---------------cut here---------------end--------------->8--- The test-init.el file should be in the testing directory which should also be the local directory. Below are the test-init.el file and the generated results. All tests are currently passing. Regards Martyn --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=test-init.el Content-Transfer-Encoding: quoted-printable Content-Description: test-init.el ;;; test-init.el --- Outline-based notes management and organizer ;; Copyright (C) 2004-2011 Free Software Foundation, Inc. ;; Author: Martyn Jago ;; Requires the non-emacs files ert-batch.el and ert-run.el (in /path/to/or= g/testing) ;; Working directory is assumed to be /path/to/org/testing ;; ...and a batch script something like... ;; /path/to/emacs/executable/Emacs -batch -l /path/to/testing/test-init.el ;; directory locations... (let ((org-dir "~/org-mode/") (emacs-lisp-dir "/Applications/Emacs.app/Contents/Resources/lisp/emac= s-lisp/")) ;; load-path... (add-to-list 'load-path "/Applications/Emacs.app/Contents/Resources/lisp/= emacs-lisp/") (mapcar (lambda (lp) "iterate over files to load" (add-to-list 'load-path lp)) (list emacs-lisp-dir (concat org-dir "lisp") (concat org-dir "testing") (concat org-dir "testing/lis= p") (concat org-dir "testing/examples") (concat org-dir "testing/con= trib") (concat org-dir "contrib") (concat org-dir "contrib/lis= p") (concat org-dir "contrib/babel/langs"))) ;; babel languages...=20=20=20=20=20=20=20 (setq org-confirm-babel-evaluate nil) (org-babel-lob-ingest (concat org-dir "contrib/babel/library-of-babel.org= ")) (org-babel-do-load-languages 'org-babel-load-languages '((ruby . t) (python . t) (C . t) (emacs-lisp . t) (sh t) (dot t) (clojure t) (ditaa t) (lilypond t))) ;; test files... (mapcar (lambda (test-file) "iterate over all test files in testing/lisp" (load-file test-file)) (directory-files (concat org-dir "testing/lisp") 1 ".*\.el" 1)) ;; run tests (message "\n------------------------- Test start ------------------------= --------------\n") (message (version)) (org-version) (message "\n") (ert-run-tests-batch-and-exit)) --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=2011-08-21.log Content-Description: results.log Loading vc-git... 21 src blocks added to Library of Babel Loading /Users/martyn/org-mode/testing/lisp/test-org.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-org-table.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-org-html.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-tangle.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-table.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-sh.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-lob.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-lilypond.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-fortran.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-exp.el (source)... Loading /Users/martyn/org-mode/testing/lisp/test-ob-awk.el (source)... ------------------------- Test start -------------------------------------- GNU Emacs 24.0.50.1 (x86_64-apple-darwin, NS apple-appkit-1038.35) of 2011-08-21 on virtualmac.porkrind.org Org-mode version 7.7 (release_7.7.246.g3dac.dirty) Running 101 tests (2011-09-06 16:10:49+0100) OVERVIEW executing Awk code block... executing Awk source code block "42" passed 1/101 ob-awk/input-none executing Awk code block (genfile)... executing Awk source code block "150" passed 2/101 ob-awk/input-src-block passed 3/101 ob-fortran/assert OVERVIEW executing Fortran code block... "word" passed 4/101 ob-fortran/character-var executing Fortran code block... "23" passed 5/101 ob-fortran/command-arguments executing Fortran code block (fortran_parameter)... "10" passed 6/101 ob-fortran/fortran-var-program executing Fortran code block... "15" passed 7/101 ob-fortran/input-var executing Fortran code block... "1.00 2.00 3.00" passed 8/101 ob-fortran/list-var executing Fortran code block... "1.00 2.00" passed 9/101 ob-fortran/list-var-from-table executing Fortran code block... passed 10/101 ob-fortran/no-variables-with-main executing Fortran code block... "42" passed 11/101 ob-fortran/preprosessor-var executing Fortran code block (hello)... "Hello world" passed 12/101 ob-fortran/simple-program passed 13/101 ob-lilypond/assert passed 14/101 ob-lilypond/check-lilypond-alias passed 15/101 ob-lilypond/feature-provision passed 16/101 ob-lilypond/ly-OSX-ly-path passed 17/101 ob-lilypond/ly-OSX-midi-path passed 18/101 ob-lilypond/ly-OSX-pdf-path passed 19/101 ob-lilypond/ly-arrange-mode Saving file /Users/martyn/org-mode/testing/examples/ob-lilypond-test.pdf... Wrote /Users/martyn/org-mode/testing/examples/ob-lilypond-test.pdf No pdf file generated so can't display! passed 20/101 ob-lilypond/ly-attempt-to-open-pdf Saving file /Users/martyn/org-mode/testing/examples/ob-lilypond-test.midi... Wrote /Users/martyn/org-mode/testing/examples/ob-lilypond-test.midi No midi file generated so can't play! passed 21/101 ob-lilypond/ly-attempt-to-play-midi passed 22/101 ob-lilypond/ly-check-for-compile-error Compiling LilyPond... passed 23/101 ob-lilypond/ly-compile-lilyfile passed 24/101 ob-lilypond/ly-compile-post-tangle passed 25/101 ob-lilypond/ly-determine-ly-path passed 26/101 ob-lilypond/ly-determine-midi-path passed 27/101 ob-lilypond/ly-determine-pdf-path passed 28/101 ob-lilypond/ly-display-pdf-post-tangle passed 29/101 ob-lilypond/ly-gen-html passed 30/101 ob-lilypond/ly-gen-png passed 31/101 ob-lilypond/ly-gen-svg passed 32/101 ob-lilypond/ly-get-header-args OVERVIEW passed 33/101 ob-lilypond/ly-mark-error-line passed 34/101 ob-lilypond/ly-nix-ly-path passed 35/101 ob-lilypond/ly-nix-midi-path passed 36/101 ob-lilypond/ly-nix-pdf-path passed 37/101 ob-lilypond/ly-parse-error-line passed 38/101 ob-lilypond/ly-parse-line-num passed 39/101 ob-lilypond/ly-play-midi-post-tangle OVERVIEW passed 40/101 ob-lilypond/ly-process-compile-error passed 41/101 ob-lilypond/ly-set-header-args passed 42/101 ob-lilypond/ly-switch-extension-with-extensions passed 43/101 ob-lilypond/ly-switch-extension-with-paths Arrange mode has been ENABLED. Arrange mode has been DISABLED. passed 44/101 ob-lilypond/ly-toggle-arrange-mode HTML generation has been ENABLED. HTML generation has been DISABLED. passed 45/101 ob-lilypond/ly-toggle-html-generation-toggles-flag Post-Tangle MIDI play has been DISABLED. Post-Tangle MIDI play has been ENABLED. passed 46/101 ob-lilypond/ly-toggle-midi-play-toggles-flag Post-Tangle PDF display has been DISABLED. Post-Tangle PDF display has been ENABLED. passed 47/101 ob-lilypond/ly-toggle-pdf-display-toggles-flag PNG image generation has been ENABLED. PNG image generation has been DISABLED. passed 48/101 ob-lilypond/ly-toggle-png-generation-toggles-flag ob-lilypond version 0.3 ob-lilypond version 0.3 passed 49/101 ob-lilypond/ly-version-command passed 50/101 ob-lilypond/ly-version-const passed 51/101 ob-lilypond/ly-win32-ly-path passed 52/101 ob-lilypond/ly-win32-midi-path passed 53/101 ob-lilypond/ly-win32-pdf-path passed 54/101 ob-lilypond/org-babel-expand-body:lilypond passed 55/101 ob-lilypond/org-babel-prep-session:lilypond passed 56/101 ob-lilypond/org-babel-tangle-lang-exts passed 57/101 ob-lilypond/use-eps OVERVIEW (No changes need to be saved) Setting up indent for shell type bash setting up indent stuff Indentation variables are now local. Indentation setup for shell type bash Wrote /Users/martyn/org-mode/testing/examples/babel.sh tangled 1 code block from babel.org passed 58/101 ob-tangle/continued-code-blocks-w-noweb-ref file:"~/org-mode/testing/examples/babel.org" passed 59/101 ob-tangle/expand-headers-as-noweb-references (No changes need to be saved) tangled 0 code blocks from babel.org passed 60/101 ob-tangle/no-excessive-id-insertion-on-tangle OVERVIEW Exporting... Exporting... HTML export done, pushed to kill ring and clipboard passed 61/101 test-ob-exp/org-babel-exp-src-blocks/w-no-file OVERVIEW Exporting... Exporting... Saving file /Users/martyn/org-mode/testing/link-in-heading.html... Wrote /Users/martyn/org-mode/testing/link-in-heading.html HTML export done, pushed to kill ring and clipboard passed 62/101 test-ob-exp/org-babel-exp-src-blocks/w-no-headers #+call: echo(input="testing") executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) "testing" executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) (("testing")) executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) "testing" executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) (("testing")) executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) "testing" executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) (("testing")) executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) "testing" executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) (("testing")) executing Emacs-Lisp code block (lob-minus)... (a (quote 8)) (b (quote 4)) "4" executing Emacs-Lisp code block... (results (quote 4)) "4" executing Emacs-Lisp code block (echo)... (input (quote "testing")) "testing" executing Emacs-Lisp code block... (results (quote "testing")) "testing" executing Emacs-Lisp code block (concat)... (a (quote 1)) (b (quote 2)) (c (quote 3)) "123" executing Emacs-Lisp code block... (results (quote "123")) "123" passed 63/101 test-ob-lob/call-with-header-arguments Exporting... executing Emacs-Lisp code block (double)... (it (quote 0)) "0" executing Emacs-Lisp code block... (results (quote 0)) Code block evaluation complete. executing Emacs-Lisp code block (double)... (it (quote 1)) "2" executing Emacs-Lisp code block... (results (quote 2)) Code block evaluation complete. executing Emacs-Lisp code block (double)... (it (quote 3)) "6" executing Emacs-Lisp code block... (results (quote 6)) Code block evaluation complete. executing Emacs-Lisp code block (double)... (it (quote 4)) "8" executing Emacs-Lisp code block... (results (quote 8)) Code block evaluation complete. executing Emacs-Lisp code block (double)... (it (quote 5)) "10" executing Emacs-Lisp code block... (results (quote 10)) Code block evaluation complete. Exporting... HTML export done, pushed to kill ring and clipboard passed 64/101 test-ob-lob/export-lob-lines 7 src blocks added to Library of Babel passed 65/101 test-ob-lob/ingest Babel evaluation exited with code 1 passed 66/101 test-ob-sh/dont-error-on-empty-results passed 67/101 test-ob-sh/dont-insert-spaces-on-expanded-bodies passed 68/101 test-org-babel/default-inline-header-args executing Emacs-Lisp code block... (prop (quote 4)) Code block evaluation complete. passed 69/101 test-org-babel/elisp-in-header-arguments passed 70/101 test-org-babel/get-header OVERVIEW passed 71/101 test-org-babel/get-src-block-info-body OVERVIEW passed 72/101 test-org-babel/get-src-block-info-language OVERVIEW passed 73/101 test-org-babel/get-src-block-info-tangle passed 74/101 test-org-babel/inline-src-block-regexp executing Sh code block... "1" executing Sh code block... "2" executing Sh code block... "3" passed 75/101 test-org-babel/inline-src-blocks executing Emacs-Lisp code block... (numbers (quote (1 2 3 4 5 6 7))) (letters (quote (a b c d e f g))) Code block evaluation complete. passed 76/101 test-org-babel/multi-line-header-arguments passed 77/101 test-org-babel/multi-line-header-regexp passed 78/101 test-org-babel/org-babel-get-inline-src-block-matches ((:var num . 9) (:colname-names) (:rowname-names) (:result-params "output" "replace") (:result-type . output) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "output replace") (:session) (:padnewline . "yes") (:hlines . "no")) passed 79/101 test-org-babel/parse-header-args file:"~/org-mode/testing/examples/babel.org" executing Emacs-Lisp code block... (text (quote "has length 14 ")) "14" passed 80/101 test-org-babel/parse-header-args2 executing Emacs-Lisp code block (i-have-a-name)... Code block evaluation complete. passed 81/101 test-org-babel/simple-named-code-block executing Emacs-Lisp code block (four)... (1 2 3 4) executing Emacs-Lisp code block... (four (quote (1 2 3 4))) Code block evaluation complete. passed 82/101 test-org-babel/simple-variable-resolution passed 83/101 test-org-babel/src-block-regexp passed 84/101 test-org-babel/src-name-regexp passed 85/101 test-org-babel/src-name-w-name-regexp passed 86/101 test-org-html/export-link/0 passed 87/101 test-org-table/org-table-convert-refs-to-an/1 passed 88/101 test-org-table/org-table-convert-refs-to-an/3 passed 89/101 test-org-table/org-table-convert-refs-to-rc/1 passed 90/101 test-org-table/org-table-convert-refs-to-rc/2 OVERVIEW Re-applying formulas to full table... Re-applying formulas to full table...(line 1) Re-applying formulas to 1 lines...done Re-applying formulas...done Re-applying formulas...done passed 91/101 test-org-table/simple-formula passed 92/101 test-org/org-link-escape-ascii-character passed 93/101 test-org/org-link-escape-ascii-ctrl-character passed 94/101 test-org/org-link-escape-custom-table passed 95/101 test-org/org-link-escape-custom-table-merge passed 96/101 test-org/org-link-escape-multibyte-character passed 97/101 test-org/org-link-escape-url-with-escaped-char passed 98/101 test-org/org-link-unescape-ascii-character passed 99/101 test-org/org-link-unescape-ascii-ctrl-character passed 100/101 test-org/org-link-unescape-ascii-extended-char passed 101/101 test-org/org-link-unescape-multibyte-character Ran 101 tests, 101 results as expected (2011-09-06 16:10:54+0100) --=-=-= Content-Type: text/plain [...] --- Org-mode version 7.7 GNU Emacs 24.0.50.1 (x86_64-apple-darwin, NS apple-appkit-1038.35) of 2011-08-21 on virtualmac.porkrind.org --=-=-=--