annotate src/testdir/README.txt @ 7851:ed080aca141b

Added tag v7.4.1222 for changeset 10f17a228661a2583730542423769de321315597
author Christian Brabandt <cb@256bit.org>
date Sun, 31 Jan 2016 15:00:05 +0100
parents 9d67399f49c6
children 26f555e9aab1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 This directory contains tests for various Vim features.
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
3 If it makes sense, add a new test method to an already existing file. You may
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
4 want to separate it from other tests with comment lines.
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 The numbered tests are older, we have switched to named tests.
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
7
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
8 And then you can chose between a new style test, which is a Vim script, or an
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
9 old style test, which uses Normal mode commands. Use a new style test if you
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
10 can.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
11
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
13 TO ADD A NEW STYLE TEST:
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
14
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
15 1) Create a test_<subject>.vim file.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
16 2) Add test_<subject>.vim to NEW_TESTS in Make_all.mak in alphabetical order.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
17 3) Use make test_<subject>.res to run a single test in src/testdir/.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
18 Use make test_<subject> to run a single test in src/.
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 4) Also add an entry in src/Makefile.
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
21 What you can use (see test_assert.vim for an example):
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
22 - Call assert_equal(), assert_true() and assert_false().
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
23 - Use try/catch to check for exceptions.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
24 - Use alloc_fail() to have memory allocation fail. This makes it possible to
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
25 to check memory allocation failures are handled gracefully. You need to
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
26 change the source code to add an ID to the allocation. Update LAST_ID_USED
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
27 above alloc_id() to the highest ID used.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
28
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
29
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
30 TO ADD AN OLD STYLE TEST:
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
31
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
32 1) Create test_<subject>.in and test_<subject>.ok files.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
33 2) Add test_<subject>.out to SCRIPTS_ALL in Make_all.mak in alphabetical order.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
34 3) Use make test_<subject>.out to run a single test in src/testdir/.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
35 Use make test_<subject> to run a single test in src/.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
36 4) Also add an entry in src/Makefile.
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
37
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
38 Keep in mind that the files are used as if everything was typed:
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
39 - To add comments use: :" (that's an Ex command comment)
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
40 - A line break is like pressing Enter. If that happens on the last line
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
41 you'll hear a beep!