comparison src/testdir/README.txt @ 14689:796d794cdc88 v8.1.0357

patch 8.1.0357: instructions for tests are outdated commit https://github.com/vim/vim/commit/02c972153d0f36fd1ae4e7069869f51dc11c6c7d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 9 15:56:06 2018 +0200 patch 8.1.0357: instructions for tests are outdated Problem: Instructions for tests are outdated. (Jason Franklin) Solution: Update the text.
author Christian Brabandt <cb@256bit.org>
date Sun, 09 Sep 2018 16:00:08 +0200
parents 013c44d9dc09
children 6e4e0d43b20b
comparison
equal deleted inserted replaced
14688:c3cd3c50df91 14689:796d794cdc88
13 13
14 TO ADD A NEW STYLE TEST: 14 TO ADD A NEW STYLE TEST:
15 15
16 1) Create a test_<subject>.vim file. 16 1) Create a test_<subject>.vim file.
17 2) Add test_<subject>.res to NEW_TESTS in Make_all.mak in alphabetical order. 17 2) Add test_<subject>.res to NEW_TESTS in Make_all.mak in alphabetical order.
18 3) Also add an entry in src/Makefile. 18 3) Also add an entry "test_<subject>" in src/Make_all.mak.
19 4) Use make test_<subject>.res to run a single test in src/testdir/. 19 4) Use make test_<subject>.res to run a single test in src/testdir/.
20 Use make test_<subject> to run a single test in src/. 20 Use make test_<subject> to run a single test in src/.
21 21
22 At 2), instead of running the test separately, it can be included in
23 "test_alot". Do this for quick tests without side effects. The test runs a
24 bit faster, because Vim doesn't have to be started, one Vim instance runs many
25 tests.
26
27
22 What you can use (see test_assert.vim for an example): 28 What you can use (see test_assert.vim for an example):
29
23 - Call assert_equal(), assert_true(), assert_false(), etc. 30 - Call assert_equal(), assert_true(), assert_false(), etc.
24 - Use try/catch to check for exceptions. 31
25 - Use alloc_fail() to have memory allocation fail. This makes it possible 32 - Use assert_fails() to check for expected errors.
26 to check memory allocation failures are handled gracefully. You need to 33
27 change the source code to add an ID to the allocation. Update LAST_ID_USED 34 - Use try/catch to avoid an exception aborts the test.
28 above alloc_id() to the highest ID used. 35
29 - Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for 36 - Use alloc_fail() to have memory allocation fail. This makes it possible to
30 a while. E.g. to trigger the CursorMovedI autocommand event. 37 check memory allocation failures are handled gracefully. You need to change
31 See test_cursor_func.vim for an example 38
39 - the source code to add an ID to the allocation. Update LAST_ID_USED above
40 alloc_id() to the highest ID used.
41
42 - Use test_override() to make Vim behave differently, e.g. if char_avail()
43 must return FALSE for a while. E.g. to trigger the CursorMovedI autocommand
44 event.
45
46 - See test_cursor_func.vim for an example.
47
32 - If the bug that is being tested isn't fixed yet, you can throw an exception 48 - If the bug that is being tested isn't fixed yet, you can throw an exception
33 so that it's clear this still needs work. E.g.: 49 with "Skipped" so that it's clear this still needs work. E.g.: throw
34 throw "Skipped: Bug with <c-e> and popupmenu not fixed yet" 50 "Skipped: Bug with <c-e> and popupmenu not fixed yet"
51
35 - See the start of runtest.vim for more help. 52 - See the start of runtest.vim for more help.
36 53
37 54
38 TO ADD A SCREEN DUMP TEST: 55 TO ADD A SCREEN DUMP TEST:
39 56