Update testing/README

* testing/README: Minor update, add how to run several tests.
This commit is contained in:
Michael Brand 2016-06-25 17:08:23 +02:00
parent 4b2aa43ce6
commit 994e9ebf0b
1 changed files with 28 additions and 24 deletions

View File

@ -38,7 +38,7 @@ The options in the above command are explained below.
* Trigger testing with 'make test'
Target =test= can be used to trigger a test run.
Target ~test~ can be used to trigger a test run.
#+BEGIN_SRC sh :dir (expand-file-name "..")
make test
@ -78,36 +78,40 @@ load and run the test suite with the following commands.
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
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" ;; expecting %5B is right
(should (string= "%5B" ; Expecting %5B is correct.
(org-link-escape "[")))
(should (string= "%5C" ;; expecting %5C is wrong, %5D right
(should (string= "%5C" ; Expecting %5C is wrong, %5D correct.
(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.
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"
To run several tests: ~M-x ert RET "<your regexp here>" 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.
To run all tests of a single test file: ~M-x ert-delete-all-tests
RET~ and confirm. ~M-x load-file RET testing/lisp/<file>.el RET
M-x ert RET t RET~.
Consider to set
#+BEGIN_SRC emacs-lisp
(setq pp-escape-newlines nil)
#+END_SRC
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
then it will result in some test failure, as there are tests which
rely on this behavior.
- If the variable ~org-babel-no-eval-on-ctrl-c-ctrl-c~ is non-nil then
it will result in some test failure, as there are tests which rely
on this behavior.