comparison src/testdir/test_function_lists.vim @ 20689:b005de48b374 v8.2.0898

patch 8.2.0898: missing help for a function goes unnoticed Commit: https://github.com/vim/vim/commit/6b0e528368415476bfc3a8414c9c70f9852b1517 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 4 15:52:25 2020 +0200 patch 8.2.0898: missing help for a function goes unnoticed Problem: Missing help for a function goes unnoticed. Solution: Add a test. (Gary Johnson)
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Jun 2020 16:00:04 +0200
parents
children f342bdc79295
comparison
equal deleted inserted replaced
20688:4532df355481 20689:b005de48b374
1 " Test to verify that the three function lists,
2 "
3 " global_functions[] in src/evalfunc.c
4 " *functions* in runtime/doc/eval.txt
5 " *function-list* in runtime/doc/usr_41.txt
6 "
7 " contain the same functions and that the global_functions and ":help
8 " functions" lists are in ASCII order.
9
10 func Test_function_lists()
11
12 " Delete any files left over from an earlier run of this test.
13
14 call delete("Xglobal_functions.diff")
15 call delete("Xfunctions.diff")
16 call delete("Xfunction-list.diff")
17
18 " Create a file of the functions in evalfunc.c:global_functions[].
19
20 enew!
21 read ../evalfunc.c
22 1,/^static funcentry_T global_functions\[\] =$/d
23 call search('^};$')
24 .,$d
25 v/^ {/d
26 %s/^ {"//
27 %s/".*//
28 w! Xglobal_functions
29
30 " Verify that those functions are in ASCII order.
31
32 sort u
33 w! Xsorted_global_functions
34 let l:unequal = assert_equalfile("Xsorted_global_functions", "Xglobal_functions",
35 \ "global_functions[] not sorted")
36 if l:unequal && executable("diff")
37 call system("diff -u Xsorted_global_functions Xglobal_functions > Xglobal_functions.diff")
38 endif
39
40 " Create a file of the functions in evalfunc.c:global_functions[] that are
41 " not obsolete, sorted in ASCII order.
42
43 enew!
44 read ../evalfunc.c
45 1,/^static funcentry_T global_functions\[\] =$/d
46 call search('^};$')
47 .,$d
48 v/^ {/d
49 g/\/\/ obsolete$/d
50 %s/^ {"//
51 %s/".*//
52 sort u
53 w! Xsorted_current_global_functions
54
55 " Verify that the ":help functions" list is complete and in ASCII order.
56
57 enew!
58 read ../../runtime/doc/eval.txt
59 call search('\*functions\*$')
60 call search('^USAGE')
61 1,.d
62 call search('\*\K\k*()\*$')
63 .,$d
64 v/^\S/d
65 %s/(.*//
66 let l:lines = getline(1, '$')
67 call uniq(l:lines)
68 call writefile(l:lines, "Xfunctions")
69 let l:unequal = assert_equalfile("Xsorted_current_global_functions", "Xfunctions",
70 \ "\":help functions\" not sorted or incomplete")
71 if l:unequal && executable("diff")
72 call system("diff -u Xsorted_current_global_functions Xfunctions > Xfunctions.diff")
73 endif
74
75 " Verify that the ":help function-list" list is complete.
76
77 enew!
78 read ../../runtime/doc/usr_41.txt
79 call search('\*function-list\*$')
80 1,.d
81 call search('^==*$')
82 .,$d
83 v/^\t\S/d
84 %s/(.*//
85 %left
86 sort u
87 w! Xfunction-list
88 let l:unequal = assert_equalfile("Xsorted_current_global_functions", "Xfunction-list",
89 \ "\":help functions-list\" incomplete")
90 if l:unequal && executable("diff")
91 call system("diff -u Xsorted_current_global_functions Xfunction-list > Xfunction-list.diff")
92 endif
93
94 " Clean up.
95
96 call delete("Xglobal_functions")
97 call delete("Xsorted_global_functions")
98 call delete("Xsorted_current_global_functions")
99 call delete("Xfunctions")
100 call delete("Xfunction-list")
101 enew!
102
103 endfunc
104
105 " vim: shiftwidth=2 sts=2 expandtab