-
Notifications
You must be signed in to change notification settings - Fork 348
Writing tests
Gracjan Polak edited this page Sep 18, 2015
·
3 revisions
Tests for haskell-mode reside in tests
directory and are divided roughly according to functionality. To run the test suite use the command:
make check
or
make check EMACS=/path/to/your/emacs
As test framework we use Emacs Lisp Regression Testing. A test roughly looks like this:
(ert-deftest haskell-test ()
(should (equal .. ..))
(should (not (equal .. ..))
...)
To document that a functionality has a known issue waiting for a bugfix use tests that are expected to fail:
(ert-deftest haskell-test ()
:expected-result :failed
(should (equal .. ..))
(should (not (equal .. ..))
...)
Notes about tests cases:
- names of tests must be unique and should be meaningful
- do not use docstrings as those are not shown when a tests fails
- the
should
macro tries to explain what went wrong, make extra sure that in case of test failure reported error message contains necessary information to proceed with fixing - tests that are expected to fail are a worthwhile contribution