aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-09 14:42:20 -0700
committerGitHub <noreply@github.com>2019-09-09 14:42:20 -0700
commit0809533b88899b11516461d0c9997b917a153135 (patch)
treebb72a1afa35e69dd93011c3826ab6c39e52ff535 /test
parent853683e72a780afef3ecebd8d46e32983abe1798 (diff)
parente5d5fc0857935b4f67058a6a2dcfbc573331e3f6 (diff)
downloadrneovim-0809533b88899b11516461d0c9997b917a153135.tar.gz
rneovim-0809533b88899b11516461d0c9997b917a153135.tar.bz2
rneovim-0809533b88899b11516461d0c9997b917a153135.zip
Merge #10546 'doc'
Diffstat (limited to 'test')
-rw-r--r--test/README.md36
1 files changed, 11 insertions, 25 deletions
diff --git a/test/README.md b/test/README.md
index 60279589b1..64892b5576 100644
--- a/test/README.md
+++ b/test/README.md
@@ -140,7 +140,7 @@ To run a *specific* functional test:
To *repeat* a test:
- .deps/usr/bin/busted --lpath='build/?.lua' --filter 'foo' --repeat 1000 test/functional/ui/foo_spec.lua
+ BUSTED_ARGS="--repeat=100 --no-keep-going" TEST_FILE=test/functional/foo_spec.lua make functionaltest
### Filter by tag
@@ -173,43 +173,27 @@ Writing tests
Guidelines
----------
-- Consider [BDD](http://en.wikipedia.org/wiki/Behavior-driven_development)
- guidelines for organization and readability of tests. Describe what you're
- testing (and the environment if applicable) and create specs that assert its
- behavior.
-- For testing static functions or functions that have side effects visible only
- in module-global variables, create accessors for the modified variables. For
- example, say you are testing a function in misc1.c that modifies a static
- variable, create a file `test/c-helpers/misc1.c` and add a function that
- retrieves the value after the function call. Files under `test/c-helpers` will
- only be compiled when building the test shared library.
- Luajit needs to know about type and constant declarations used in function
prototypes. The
[helpers.lua](https://github.com/neovim/neovim/blob/master/test/unit/helpers.lua)
file automatically parses `types.h`, so types used in the tested functions
- must be moved to it to avoid having to rewrite the declarations in the test
- files (even though this is how it's currently done currently in the misc1/fs
- modules, but contributors are encouraged to refactor the declarations).
- - Macro constants must be rewritten as enums so they can be "visible" to the
- tests automatically.
-- Busted supports various "output providers". The
- **[gtest](https://github.com/Olivine-Labs/busted/pull/394) output provider**
- shows verbose details that can be useful to diagnose hung tests. Either modify
- the Makefile or compile with `make
- CMAKE_EXTRA_FLAGS=-DBUSTED_OUTPUT_TYPE=gtest` to enable it.
-- **Use busted's `pending()` feature** to skip tests
+ could be moved to it to avoid having to rewrite the declarations in the test
+ files.
+ - `#define` constants must be rewritten `const` or `enum` so they can be
+ "visible" to the tests.
+- Use **pending()** to skip tests
([example](https://github.com/neovim/neovim/commit/5c1dc0fbe7388528875aff9d7b5055ad718014de#diff-bf80b24c724b0004e8418102f68b0679R18)).
Do not silently skip the test with `if-else`. If a functional test depends on
some external factor (e.g. the existence of `md5sum` on `$PATH`), *and* you
can't mock or fake the dependency, then skip the test via `pending()` if the
external factor is missing. This ensures that the *total* test-count
(success + fail + error + pending) is the same in all environments.
- - *Note:* `pending()` is ignored if it is missing an argument _unless_ it is
+ - *Note:* `pending()` is ignored if it is missing an argument, unless it is
[contained in an `it()` block](https://github.com/neovim/neovim/blob/d21690a66e7eb5ebef18046c7a79ef898966d786/test/functional/ex_cmds/grep_spec.lua#L11).
Provide empty function argument if the `pending()` call is outside of `it()`
([example](https://github.com/neovim/neovim/commit/5c1dc0fbe7388528875aff9d7b5055ad718014de#diff-bf80b24c724b0004e8418102f68b0679R18)).
-- Really long `source([=[...]=])` blocks may break syntax highlighting. Try
- `:syntax sync fromstart` to fix it.
+- Really long `source([=[...]=])` blocks may break Vim's Lua syntax
+ highlighting. Try `:syntax sync fromstart` to fix it.
Where tests go
--------------
@@ -254,6 +238,8 @@ Test behaviour is affected by environment variables. Currently supported
treated as Integer; when defined, treated as String; when defined, treated as
Number; !must be defined to function properly):
+- `BUSTED_ARGS` (F) (U): arguments forwarded to `busted`.
+
- `GDB` (F) (D): makes nvim instances to be run under `gdbserver`. It will be
accessible on `localhost:7777`: use `gdb build/bin/nvim`, type `target remote
:7777` inside.