annotate src/testdir/README.txt @ 20435:61d2eb1413f2 v8.2.0772

patch 8.2.0772: Vim9: some variable initializations not tested Commit: https://github.com/vim/vim/commit/df671b4629a0c6451c067cafd2534b7261f41277 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 16 22:33:33 2020 +0200 patch 8.2.0772: Vim9: some variable initializations not tested Problem: Vim9: some variable initializations not tested. Solution: Add a few more tests
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 May 2020 22:45:03 +0200
parents 07627d1b4d8c
children baccf9e06efe
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.
15430
d94901eeb762 patch 8.1.0723: cannot easily run specific test when in src/testdir
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
2 For testing an indent script see runtime/indent/testdir/README.txt.
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
4 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
5 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
6
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
7 The numbered tests are older, we have switched to named tests. Don't add any
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
8 more numbered tests.
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
9
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8011
diff changeset
10 And then you can choose between a new style test, which is a Vim script, or an
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
11 old style test, which uses Normal mode commands. Use a new style test if you
9909
3ee84d270ea7 commit https://github.com/vim/vim/commit/9e4d8215d386100ab660d7d11e6620fd148b605e
Christian Brabandt <cb@256bit.org>
parents: 9228
diff changeset
12 can. Use an old style test when it needs to run without the +eval feature.
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
13
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
15 TO ADD A NEW STYLE TEST:
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
16
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
17 1) Create a test_<subject>.vim file.
15430
d94901eeb762 patch 8.1.0723: cannot easily run specific test when in src/testdir
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
18 2) Add test_<subject>.res to NEW_TESTS_RES in Make_all.mak in alphabetical
d94901eeb762 patch 8.1.0723: cannot easily run specific test when in src/testdir
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
19 order.
d94901eeb762 patch 8.1.0723: cannot easily run specific test when in src/testdir
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
20 3) Also add an entry "test_<subject>" to NEW_TESTS in Make_all.mak.
d94901eeb762 patch 8.1.0723: cannot easily run specific test when in src/testdir
Bram Moolenaar <Bram@vim.org>
parents: 15034
diff changeset
21 4) Use make test_<subject> to run a single test.
6168
93aa03401309 updated for version 7.4.420
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
23 At 2), instead of running the test separately, it can be included in
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
24 "test_alot". Do this for quick tests without side effects. The test runs a
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
25 bit faster, because Vim doesn't have to be started, one Vim instance runs many
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
26 tests.
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
27
19465
07627d1b4d8c patch 8.2.0290: running individual test differs from all tests
Bram Moolenaar <Bram@vim.org>
parents: 16087
diff changeset
28 At 4), to run a test in GUI, add "GUI_FLAG=-g" to the make command.
07627d1b4d8c patch 8.2.0290: running individual test differs from all tests
Bram Moolenaar <Bram@vim.org>
parents: 16087
diff changeset
29
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
30
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
31 What you can use (see test_assert.vim for an example):
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
32
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
33 - Call assert_equal(), assert_true(), assert_false(), etc.
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
34
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
35 - Use assert_fails() to check for expected errors.
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
36
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
37 - Use try/catch to avoid an exception aborts the test.
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
38
16087
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
39 - Use test_alloc_fail() to have memory allocation fail. This makes it possible
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
40 to check memory allocation failures are handled gracefully. You need to
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
41 change the source code to add an ID to the allocation. Add a new one to
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
42 alloc_id_T, before aid_last.
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
43
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
44 - Use test_override() to make Vim behave differently, e.g. if char_avail()
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
45 must return FALSE for a while. E.g. to trigger the CursorMovedI autocommand
16087
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
46 event. See test_cursor_func.vim for an example.
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
47
10100
26441931dad7 commit https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84
Christian Brabandt <cb@256bit.org>
parents: 9909
diff changeset
48 - If the bug that is being tested isn't fixed yet, you can throw an exception
14689
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
49 with "Skipped" so that it's clear this still needs work. E.g.: throw
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
50 "Skipped: Bug with <c-e> and popupmenu not fixed yet"
796d794cdc88 patch 8.1.0357: instructions for tests are outdated
Christian Brabandt <cb@256bit.org>
parents: 13304
diff changeset
51
9228
ea504064c996 commit https://github.com/vim/vim/commit/fd89d7ea81b18d32363456b16258174dc9e095dc
Christian Brabandt <cb@256bit.org>
parents: 8011
diff changeset
52 - See the start of runtest.vim for more help.
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
53
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
54
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 10549
diff changeset
55 TO ADD A SCREEN DUMP TEST:
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 10549
diff changeset
56
15034
6e4e0d43b20b patch 8.1.0528: various typos in comments
Bram Moolenaar <Bram@vim.org>
parents: 14689
diff changeset
57 Mostly the same as writing a new style test. Additionally, see help on
13304
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 10549
diff changeset
58 "terminal-dumptest". Put the reference dump in "dumps/Test_func_name.dump".
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 10549
diff changeset
59
013c44d9dc09 patch 8.0.1526: no test using a screen dump yet
Christian Brabandt <cb@256bit.org>
parents: 10549
diff changeset
60
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
61 TO ADD AN OLD STYLE TEST:
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
62
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
63 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
64 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
65 3) Use make test_<subject>.out to run a single test in src/testdir/.
16087
e992f31274b7 patch 8.1.1048: minor issues with tests
Bram Moolenaar <Bram@vim.org>
parents: 15430
diff changeset
66 Use make test_<subject> to run a single test in src/.
7517
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
67 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
68
9d67399f49c6 commit https://github.com/vim/vim/commit/6602af7fe069246dbcf419c3e904a78b60e7d4dc
Christian Brabandt <cb@256bit.org>
parents: 7478
diff changeset
69 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
70 - 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
71 - 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
72 you'll hear a beep!