README 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # -*- mode:org -*-
  2. #+TITLE: Org-mode Testing
  3. #+PROPERTY: results silent
  4. * Dependencies
  5. The only dependency is [[http://www.emacswiki.org/emacs/ErtTestLibrary][ERT]] the Emacs testing library which ships with
  6. Emacs24. If you are running an older version of Emacs and don't
  7. already have ERT installed it can be installed from its old [[https://github.com/ohler/ert][git
  8. repository]].
  9. * Non-interactive batch testing from the command line
  10. The simplest way to run the Org-mode test suite is from the command
  11. line with the following invocation. Note that the paths below are
  12. relative to the base of the Org-mode directory.
  13. #+BEGIN_SRC sh :dir (expand-file-name "..")
  14. # For Emacs earlier than 24, add -L /path/to/ert
  15. emacs -Q --batch \
  16. -L lisp/ -L testing/ -L testing/lisp -l lisp/org.el \
  17. -l lisp/org-id.el -l testing/org-test.el \
  18. --eval "(progn (org-reload) (setq org-confirm-babel-evaluate nil))" \
  19. -f org-test-run-batch-tests
  20. #+END_SRC
  21. The options in the above command are explained below.
  22. | -Q | ignores any personal configuration ensuring a vanilla Emacs instance is used |
  23. | --batch | runs Emacs in "batch" mode with no gui and termination after execution |
  24. | -l | loads Org-mode and the org mode test suite defined in testing/org-test.el |
  25. | --eval | reloads Org-mode and allows evaluation of code blocks by the tests |
  26. | -f | actually runs the tests using the `org-test-run-batch-tests' function |
  27. * Interactive testing from within Emacs
  28. To run the Org-mode test suite from a current Emacs instance simply
  29. load and run the test suite with the following commands.
  30. 1) First load the test suite.
  31. #+BEGIN_SRC emacs-lisp :var here=(buffer-file-name)
  32. (add-to-list 'load-path (file-name-directory here))
  33. (require 'org-test)
  34. #+END_SRC
  35. 2) Then run the test suite.
  36. #+BEGIN_SRC emacs-lisp
  37. (org-test-run-all-tests)
  38. #+END_SRC
  39. * Troubleshooting
  40. - If the value of the =org-babel-no-eval-on-ctrl-c-ctrl-c= is non-nil
  41. then it will result in some test failure, as there are tests which
  42. rely on this behavior.