aboutsummaryrefslogtreecommitdiff
path: root/vim/README.md
blob: d98c99b38d12b4c3fa0efa5bcccb37c11a45307c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Tests for vis - a vim-like editor frontend
------------------------------------------

The basic idea is to feed the same keyboard input to both vim
and vis and compare their respective results.

A test constitutes of 2 files:

 * `test.in` the file/buffer content with which the editor is started
 * `test.keys` a file containing the keyboard input as would normally
   be typed by a user

The `*.keys` file are piped through the C preprocessor `cpp(1)`, trailing
white spaces are stripped before the [keys utility](../util) translates
the symbolic keys to terminal input sequences suitable for consumption
by the actual editor processes. In rare cases it might be necessary to
inspect intermediate states of this pipeline for debugging purposes.
Some general hints on writing test:

 * Make sure all input files are properly new line terminated, otherwise
   you will get test failures because vim will add a trailing new line
   whereas vis leafs the input file as is.

 * Place logically different commands on different input lines. The
   new lines are insignificant. To enter a literal new line use `<Enter>`.

 * Use C style comments `/* ... */` or `// ...` to explain complex text
   manipulations. However, be aware that due to the use of the C
   preprocessor comments do not mix well with unterminated string
   constants as used to specify registers.

The top level shell script `test.sh` looks for the `*.keys` files in
subdirectories, executes both editors and compares the resulting output.
`test.sh path/to/test` (without the file extension) runs an individual
test.

Type `make` to run all tests.