2012-07-31 01:22:30 +08:00
|
|
|
# Tests
|
2011-09-23 03:48:11 +08:00
|
|
|
|
|
|
|
Like, yes, we have some! :)
|
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
## el-get manual tests
|
2011-09-23 03:48:11 +08:00
|
|
|
|
|
|
|
Tries to cover some known issues, example that will allow building a
|
|
|
|
regression test suite some day.
|
|
|
|
|
2012-03-05 04:14:06 +08:00
|
|
|
Typical run (in bash):
|
2011-09-23 03:48:11 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
mkdir -p /tmp/test/.emacs.d/el-get/
|
|
|
|
rm -rf /tmp/test/.emacs.d/el-get/*
|
|
|
|
HOME=/tmp/test /usr/bin/emacs-snapshot-gtk -Q -batch -L . -l el-get \
|
|
|
|
-l test/el-get-issue-303.el
|
2011-09-23 03:48:11 +08:00
|
|
|
|
|
|
|
At the moment you need to run the el-get-issue scripts with some known
|
2012-03-05 04:14:06 +08:00
|
|
|
working el-get version to know what to expect, and you probably need
|
|
|
|
to have el-get installed at +~/dev/emacs/el-get/+ for this to work
|
|
|
|
as-is.
|
2011-09-23 03:48:11 +08:00
|
|
|
|
|
|
|
Yet it might be useful.
|
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
## el-get automated tests
|
2011-09-23 03:48:11 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
### Simple script-based automation
|
2012-03-05 04:14:06 +08:00
|
|
|
|
|
|
|
In the test directory, there is a simple bash script called
|
|
|
|
+run-test.sh+ that attempts to automate the manual steps detailed
|
|
|
|
above. The script creates a temporary home directory and runs emacs in
|
2012-04-04 00:42:16 +08:00
|
|
|
batch mode, first loading el-get and then the specified test file. An
|
|
|
|
invocation equivalent to the above would look like this (starting from
|
|
|
|
the main el-get directory):
|
2012-03-05 04:14:06 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
test/run-test.sh el-get-issue-303.el
|
2012-03-05 04:14:06 +08:00
|
|
|
|
|
|
|
or even just
|
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
test/run-test.sh 303
|
2012-03-05 04:14:06 +08:00
|
|
|
|
|
|
|
The script takes care of cleaning up the temporary directory after the
|
|
|
|
test, so you can run tests one after the other without previous tests
|
2012-04-04 00:42:16 +08:00
|
|
|
causing problems for later ones. The bahavior of the +run-test.sh+
|
|
|
|
script can be customized with a few environment variables:
|
2012-03-05 04:14:06 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
- `TMPDIR` and `TEST_HOME`, for controlling where the temporary home
|
2012-03-05 04:14:06 +08:00
|
|
|
directory is created;
|
2012-07-31 01:22:30 +08:00
|
|
|
- `EL_GET_LIB_DIR`, the directory where the el-get code resides;
|
|
|
|
- `EMACS`, which can be used to override the copy of emacs found in
|
|
|
|
your `PATH`, or to provide one if there is no emacs in your `PATH`
|
2012-03-05 04:14:06 +08:00
|
|
|
or it is installed under a nonstandard name.
|
|
|
|
|
2012-04-04 00:42:16 +08:00
|
|
|
You can run multiple tests by simply providing multiple test files to
|
2012-07-31 01:22:30 +08:00
|
|
|
`run-test.sh`:
|
2012-03-05 04:14:06 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
test/run-test.sh 200 303 310
|
2012-03-05 04:14:06 +08:00
|
|
|
|
|
|
|
When running multiple tests, the script will wait 5 seconds between
|
|
|
|
tests, since many tests involve downloading files from the same few
|
|
|
|
servers (Github, emacswiki, marmalade, etc.), and it is impolite to
|
2012-03-05 04:40:16 +08:00
|
|
|
download a large number of files in rapid succession just for
|
|
|
|
testing. There is a script called +run-all-tests.sh+ that acts as a
|
|
|
|
shortcut for running all the available tests.
|
|
|
|
|
|
|
|
Sometimes you may want to run a test in an interactive emacs session
|
|
|
|
so that you can use Emacs' debugging facilities to investigate what
|
2012-07-31 01:22:30 +08:00
|
|
|
went wrong. To do this, use `run-test-interactive.sh` instead of
|
|
|
|
`run-test.sh`.
|
2012-03-05 04:40:16 +08:00
|
|
|
|
|
|
|
If simply want to test installation, updating, and removal of one or
|
2012-07-31 01:22:30 +08:00
|
|
|
more recipes, you can use the `test-recipe.sh` script.
|
2012-03-05 04:14:06 +08:00
|
|
|
|
2012-07-31 01:22:30 +08:00
|
|
|
### ERT-based automation
|
2012-03-05 04:14:06 +08:00
|
|
|
|
2012-11-25 09:37:37 +08:00
|
|
|
See `test.el` in this directory. You can run ERT-based tests by:
|
|
|
|
|
|
|
|
test/run-ert.sh
|
|
|
|
|
|
|
|
To run the tests with GUI window for debugging, you can use:
|
|
|
|
|
|
|
|
test/run-ert-interactive.sh
|