Skip to content

Commit 6602af7

Browse files
committed
patch 7.4.1060
Problem: Instructions for writing tests are outdated. Solution: Mention Make_all.mak. Add steps for new style tests.
1 parent fd39d08 commit 6602af7

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

src/testdir/README.txt

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
This directory contains tests for various Vim features.
22

3-
If it makes sense, try to add a new test to an already existing file. You may
4-
want to separate it from other tests in that file using :" (that's an Ex
5-
command comment).
3+
If it makes sense, add a new test method to an already existing file. You may
4+
want to separate it from other tests with comment lines.
65

76
The numbered tests are older, we have switched to named tests.
8-
And the newest way of testing is to use assert functions, see test_assert.vim
9-
for an example.
107

11-
To add a new test:
8+
And then you can chose between a new style test, which is a Vim script, or an
9+
old style test, which uses Normal mode commands. Use a new style test if you
10+
can.
11+
12+
13+
TO ADD A NEW STYLE TEST:
14+
15+
1) Create a test_<subject>.vim file.
16+
2) Add test_<subject>.vim to NEW_TESTS in Make_all.mak in alphabetical order.
17+
3) Use make test_<subject>.res to run a single test in src/testdir/.
18+
Use make test_<subject> to run a single test in src/.
19+
4) Also add an entry in src/Makefile.
20+
21+
What you can use (see test_assert.vim for an example):
22+
- Call assert_equal(), assert_true() and assert_false().
23+
- Use try/catch to check for exceptions.
24+
- Use alloc_fail() to have memory allocation fail. This makes it possible to
25+
to check memory allocation failures are handled gracefully. You need to
26+
change the source code to add an ID to the allocation. Update LAST_ID_USED
27+
above alloc_id() to the highest ID used.
28+
29+
30+
TO ADD AN OLD STYLE TEST:
31+
1232
1) Create test_<subject>.in and test_<subject>.ok files.
13-
2) Add them to all Makefiles (Make*) in alphabetical order (search for an
14-
existing test_file.out to see where to add the new one).
15-
3) Use make test_<subject>.out to run a single test file in src/testdir/.
33+
2) Add test_<subject>.out to SCRIPTS_ALL in Make_all.mak in alphabetical order.
34+
3) Use make test_<subject>.out to run a single test in src/testdir/.
35+
Use make test_<subject> to run a single test in src/.
1636
4) Also add an entry in src/Makefile.
1737

18-
Keep in mind that the files are used as if everything was typed.
19-
A line break is like pressing Enter. If that happens on the last line you'll
20-
hear a beep.
38+
Keep in mind that the files are used as if everything was typed:
39+
- To add comments use: :" (that's an Ex command comment)
40+
- A line break is like pressing Enter. If that happens on the last line
41+
you'll hear a beep!

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1060,
744746
/**/
745747
1059,
746748
/**/

0 commit comments

Comments
 (0)