annotate src/testdir/test_function_lists.vim @ 31612:c467d6e70972 v9.0.1138

patch 9.0.1138: crash when expecting varargs but it is something else Commit: https://github.com/vim/vim/commit/36818a9daafbcb8e3b06be7b07f52b2d00a61746 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 3 12:33:26 2023 +0000 patch 9.0.1138: crash when expecting varargs but it is something else Problem: Crash when expecting varargs but it is something else. Solution: Only use the member when the type is a list. (closes https://github.com/vim/vim/issues/11774)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 Jan 2023 13:45:04 +0100
parents a52697bcffa6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31140
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
1 " Test to verify that the three function lists:
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 "
31140
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
3 " - global_functions[] in src/evalfunc.c
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
4 " - *functions* in runtime/doc/builtin.txt
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
5 " - *function-list* in runtime/doc/usr_41.txt
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 "
31140
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
7 " contain the same functions and that the global_functions and
a52697bcffa6 patch 9.0.0904: various comment and indent flaws
Bram Moolenaar <Bram@vim.org>
parents: 30552
diff changeset
8 " ":help functions" lists are in ASCII order.
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 func Test_function_lists()
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 " Delete any files left over from an earlier run of this test.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 call delete("Xglobal_functions.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 call delete("Xfunctions.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 call delete("Xfunction-list.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " Create a file of the functions in evalfunc.c:global_functions[].
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 enew!
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 read ../evalfunc.c
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 1,/^static funcentry_T global_functions\[\] =$/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 call search('^};$')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 .,$d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 v/^ {/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 %s/^ {"//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 %s/".*//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 w! Xglobal_functions
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " Verify that those functions are in ASCII order.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 sort u
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 w! Xsorted_global_functions
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 let l:unequal = assert_equalfile("Xsorted_global_functions", "Xglobal_functions",
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 \ "global_functions[] not sorted")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 if l:unequal && executable("diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call system("diff -u Xsorted_global_functions Xglobal_functions > Xglobal_functions.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 endif
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " Create a file of the functions in evalfunc.c:global_functions[] that are
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " not obsolete, sorted in ASCII order.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 enew!
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 read ../evalfunc.c
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 1,/^static funcentry_T global_functions\[\] =$/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 call search('^};$')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 .,$d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 v/^ {/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 g/\/\/ obsolete$/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 %s/^ {"//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 %s/".*//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 sort u
20693
f342bdc79295 patch 8.2.0900: function list test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 20689
diff changeset
49 w! ++ff=unix Xsorted_current_global_functions
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " Verify that the ":help functions" list is complete and in ASCII order.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 enew!
26780
b24b2217ff9e patch 8.2.3918: function list test fails
Bram Moolenaar <Bram@vim.org>
parents: 24840
diff changeset
53 if filereadable('../../doc/builtin.txt')
24570
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
54 " unpacked MS-Windows zip archive
26780
b24b2217ff9e patch 8.2.3918: function list test fails
Bram Moolenaar <Bram@vim.org>
parents: 24840
diff changeset
55 read ../../doc/builtin.txt
24570
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
56 else
26780
b24b2217ff9e patch 8.2.3918: function list test fails
Bram Moolenaar <Bram@vim.org>
parents: 24840
diff changeset
57 read ../../runtime/doc/builtin.txt
24570
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
58 endif
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call search('^USAGE')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 1,.d
26780
b24b2217ff9e patch 8.2.3918: function list test fails
Bram Moolenaar <Bram@vim.org>
parents: 24840
diff changeset
61 call search('^==========')
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 .,$d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 v/^\S/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 %s/(.*//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 let l:lines = getline(1, '$')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 call uniq(l:lines)
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 call writefile(l:lines, "Xfunctions")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 let l:unequal = assert_equalfile("Xsorted_current_global_functions", "Xfunctions",
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 \ "\":help functions\" not sorted or incomplete")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 if l:unequal && executable("diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 call system("diff -u Xsorted_current_global_functions Xfunctions > Xfunctions.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 endif
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " Verify that the ":help function-list" list is complete.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 enew!
24570
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
76 if filereadable('../../doc/usr_41.txt')
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
77 " unpacked MS-Windows zip archive
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
78 read ../../doc/usr_41.txt
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
79 else
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
80 read ../../runtime/doc/usr_41.txt
27033b8bba0e patch 8.2.2824: MS-Windows: build failure with MSVC
Bram Moolenaar <Bram@vim.org>
parents: 20693
diff changeset
81 endif
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call search('\*function-list\*$')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 1,.d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call search('^==*$')
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 .,$d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 v/^\t\S/d
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 %s/(.*//
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 %left
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 sort u
20693
f342bdc79295 patch 8.2.0900: function list test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 20689
diff changeset
90 w! ++ff=unix Xfunction-list
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 let l:unequal = assert_equalfile("Xsorted_current_global_functions", "Xfunction-list",
24840
c7aa7acb23bb patch 8.2.2958: function list test fails
Bram Moolenaar <Bram@vim.org>
parents: 24570
diff changeset
92 \ "\":help function-list\" incomplete")
20689
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 if l:unequal && executable("diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 call system("diff -u Xsorted_current_global_functions Xfunction-list > Xfunction-list.diff")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 endif
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 " Clean up.
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 call delete("Xglobal_functions")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 call delete("Xsorted_global_functions")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 call delete("Xsorted_current_global_functions")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 call delete("Xfunctions")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call delete("Xfunction-list")
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 enew!
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 endfunc
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106
b005de48b374 patch 8.2.0898: missing help for a function goes unnoticed
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 " vim: shiftwidth=2 sts=2 expandtab