git clone 'git://github.com/rejeep/ert-async.el.git'
This library provides the function
ert-deftest-async, which works
ert-deftest, except that it works for async tests.
ert-async to your Cask file:
Add this to get font locking for
(remove-hook 'emacs-lisp-mode-hook 'ert--activate-font-lock-keywords) (add-hook 'emacs-lisp-mode-hook 'ert-async-activate-font-lock-keywords)
ert-deftest-async works just like
callbacks argument is a list of callback functions. Unless
all functions has been called before
ert-async-timeout seconds, the
An example. When the function
async-call callbacks, the functions
done-2 are called.
(ert-deftest-async my-async-test (done-1 done-2) (async-call-1 done-1) (async-call-2 done-2))
Note that if a callback function is called with a string as argument,
the test will fail with that error string. So if the function
async-call above callbacks with an argument, the test would have to
be written as:
(ert-deftest-async my-async-test (done-1 done-2) (async-call-1 (lambda () (funcall done-1))) (async-call-2 (lambda () (funcall done-2))))
Passing a string as argument to a callback function can be useful when you don't want a function to callback, for example:
(ert-deftest-async my-async-test (done) (async-call (lambda () (funcall done "should not callback, but did"))) (funcall done))
Contribution is much welcome!
Install Cask if you haven't already, then:
$ cd /path/to/ert-async.el $ cask
Run all tests with: