testing/README: add howto run ERT partially

* testing/README (Interactive testing from within Emacs): Add a
description how to run a single ERT or all tests of a single test
file.
This commit is contained in:
Michael Brand 2012-12-28 14:58:24 +01:00 committed by Bastien Guerry
parent 3b994e78fb
commit 710f445768
1 changed files with 32 additions and 1 deletions

View File

@ -43,11 +43,42 @@ load and run the test suite with the following commands.
(require 'org-test)
#+END_SRC
2) Then run the test suite.
2) Then run the test suite,
#+BEGIN_SRC emacs-lisp
(org-test-run-all-tests)
#+END_SRC
or when a test fails run it interactively and investigate the
problem in the ERT results buffer.
How to run one test:
Use this as a demo example of a failing test
#+BEGIN_SRC emacs-lisp
(ert-deftest test-org/org-link-escape-ascii-character-demo-of-fail ()
(should (string= "%5B" ;; expected is right
(org-link-escape "[")))
(should (string= "%5C" ;; expected is wrong, "%5D" would be right
(org-link-escape "]"))))
#+END_SRC
or evaluate the ert-deftest form of the test you want to run. Then
"M-x ert RET test-org/org-link-escape-ascii-character-demo-of-fail RET"
When not visible yet switch to the ERT results buffer named
"\*ert\*". When a test failed the ERT results buffer shows the
details of the first "should" that failed. See
(info "(ert)Running Tests Interactively") on how to re-run, start
the debugger etc.
How to run all tests of a single test file:
"M-x ert-delete-all-tests RET", confirm. Open the file
./lisp/test-*.el, "M-x eval-buffer RET", "M-x ert RET t RET"
Consider to set pp-escape-newlines nil before running the test when
looking at "should" in the ERT results buffer. Especially when
using "l" to look at passed test results and possibly missing an
appropriate setting of pp-escape-newlines made only temporarily for
the running time of the test as e. g. tests using
org-test-table-target-expect-tblfm do.
* Troubleshooting
- If the value of the =org-babel-no-eval-on-ctrl-c-ctrl-c= is non-nil