blob: f308e0ec11711d06aa08a99798b8a3352d7718c6 [file] [log] [blame]
Millyd4ad4c92024-10-06 16:27:28 +02001" Script to generate testdir/opt_test.vim from optiondefs.h
Bram Moolenaar2f5463d2017-02-25 20:40:46 +01002
Bram Moolenaar2f5463d2017-02-25 20:40:46 +01003set cpo=&vim
Bram Moolenaar5b3af142017-02-27 22:59:40 +01004
5" Only do this when build with the +eval feature.
6if 1
7
Millyd4ad4c92024-10-06 16:27:28 +02008try
9
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010010set nomore
11
Milly40c6bab2024-10-04 20:41:14 +020012const K_KENTER = -16715
13
Bram Moolenaaree1dd1c2017-03-09 13:55:01 +010014" The terminal size is restored at the end.
15" Clear out t_WS, we don't want to resize the actual terminal.
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010016let script = [
Bram Moolenaar0c1e3742019-12-27 13:49:24 +010017 \ '" DO NOT EDIT: Generated with gen_opt_test.vim',
Yegappan Lakshmanan38b85cb2022-02-24 13:28:41 +000018 \ '" Used by test_options.vim.',
Bram Moolenaar0c1e3742019-12-27 13:49:24 +010019 \ '',
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010020 \ 'let save_columns = &columns',
21 \ 'let save_lines = &lines',
Bram Moolenaaree1dd1c2017-03-09 13:55:01 +010022 \ 'set t_WS=',
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010023 \ ]
24
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010025/#define p_term
26let end = line('.')
27
Bram Moolenaar17471e82017-11-26 23:47:18 +010028" font name that works everywhere (hopefully)
29let fontname = has('win32') ? 'fixedsys' : 'fixed'
30
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010031" Two lists with values: values that work and values that fail.
32" When not listed, "othernum" or "otherstring" is used.
Millycc15bbc2024-10-18 19:58:04 +020033" When both lists are empty, skip tests for the option.
34" For boolean options, if non-empty a fixed test will be run, otherwise skipped.
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010035let test_values = {
Millycc15bbc2024-10-18 19:58:04 +020036 "\ boolean options
37 \ 'termguicolors': [
38 \ has('vtp') && !has('vcon') && !has('gui_running') ? [] : [1],
39 \ []],
40 \
41 "\ number options
Bram Moolenaara2a89732022-08-31 14:46:18 +010042 \ 'cmdheight': [[1, 2, 10], [-1, 0]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010043 \ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
Millycc15bbc2024-10-18 19:58:04 +020044 \ 'columns': [[12, 80, 10000], [-1, 0, 10]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010045 \ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
46 \ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]],
47 \ 'helpheight': [[0, 10, 100], [-1]],
Millycc15bbc2024-10-18 19:58:04 +020048 \ 'history': [[0, 1, 100, 10000], [-1, 10001]],
49 \ 'iminsert': [[0, 1, 2], [-1, 3, 999]],
50 \ 'imsearch': [[-1, 0, 1, 2], [-2, 3, 999]],
Bram Moolenaar5c6dbcb2017-08-30 22:00:20 +020051 \ 'imstyle': [[0, 1], [-1, 2, 999]],
Millycc15bbc2024-10-18 19:58:04 +020052 \ 'lines': [[2, 24, 1000], [-1, 0, 1]],
53 \ 'linespace': [[-1, 0, 2, 4, 999], ['']],
Bram Moolenaarf8a07122019-07-01 22:06:07 +020054 \ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010055 \ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
56 \ 'report': [[0, 1, 2, 9999], [-1]],
Millycc15bbc2024-10-18 19:58:04 +020057 \ 'scroll': [[0, 1, 2, 20], [-1, 999]],
58 \ 'scrolljump': [[-100, -1, 0, 1, 2, 20], [-101, 999]],
59 \ 'scrolloff': [[0, 1, 8, 999], [-1]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010060 \ 'shiftwidth': [[0, 1, 8, 999], [-1]],
61 \ 'sidescroll': [[0, 1, 8, 999], [-1]],
62 \ 'sidescrolloff': [[0, 1, 8, 999], [-1]],
Millycc15bbc2024-10-18 19:58:04 +020063 \ 'tabstop': [[1, 4, 8, 12, 9999], [-1, 0, 10000]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010064 \ 'textwidth': [[0, 1, 8, 99], [-1]],
65 \ 'timeoutlen': [[0, 8, 99999], [-1]],
66 \ 'titlelen': [[0, 1, 8, 9999], [-1]],
67 \ 'updatecount': [[0, 1, 8, 9999], [-1]],
68 \ 'updatetime': [[0, 1, 8, 9999], [-1]],
Millycc15bbc2024-10-18 19:58:04 +020069 \ 'verbose': [[-1, 0, 1, 8, 9999], ['']],
Millya9c6f902024-10-06 16:47:02 +020070 \ 'wildchar': [[-1, 0, 100, 'x', '^Y', '^@', '<Esc>', '<t_xx>', '<', '^'],
Millycc15bbc2024-10-18 19:58:04 +020071 \ ['', 'xxx', '<xxx>', '<t_xxx>', '<Esc', '<t_xx', '<C-C>',
72 \ '<NL>', '<CR>', K_KENTER]],
Millya9c6f902024-10-06 16:47:02 +020073 \ 'wildcharm': [[-1, 0, 100, 'x', '^Y', '^@', '<Esc>', '<', '^'],
Millycc15bbc2024-10-18 19:58:04 +020074 \ ['', 'xxx', '<xxx>', '<t_xxx>', '<Esc', '<t_xx', '<C-C>',
75 \ '<NL>', '<CR>', K_KENTER]],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010076 \ 'winheight': [[1, 10, 999], [-1, 0]],
77 \ 'winminheight': [[0, 1], [-1]],
78 \ 'winminwidth': [[0, 1, 10], [-1]],
79 \ 'winwidth': [[1, 10, 999], [-1, 0]],
80 \
Millycc15bbc2024-10-18 19:58:04 +020081 "\ string options
82 \ 'ambiwidth': [['', 'single', 'double'], ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +010083 \ 'background': [['', 'light', 'dark'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +020084 \ 'backspace': [[0, 1, 2, 3, '', 'indent', 'eol', 'start', 'nostop',
85 \ 'eol,start', 'indent,eol,nostop'],
86 \ [-1, 4, 'xxx']],
87 \ 'backupcopy': [['yes', 'no', 'auto'], ['', 'xxx', 'yes,no']],
88 \ 'backupext': [['xxx'], [&patchmode, '*']],
89 \ 'belloff': [['', 'all', 'backspace', 'cursor', 'complete', 'copy',
90 \ 'ctrlg', 'error', 'esc', 'ex', 'hangul', 'insertmode', 'lang',
91 \ 'mess', 'showmatch', 'operator', 'register', 'shell', 'spell',
92 \ 'term', 'wildmode', 'copy,error,shell'],
93 \ ['xxx']],
94 \ 'breakindentopt': [['', 'min:3', 'shift:4', 'shift:-2', 'sbr', 'list:5',
95 \ 'list:-1', 'column:10', 'column:-5', 'min:1,sbr,shift:2'],
96 \ ['xxx', 'min', 'min:x', 'min:-1', 'shift:x', 'sbr:1', 'list:x',
97 \ 'column:x']],
98 \ 'browsedir': [['', 'last', 'buffer', 'current', './Xdir\ with\ space'],
99 \ ['xxx']],
100 \ 'bufhidden': [['', 'hide', 'unload', 'delete', 'wipe'],
101 \ ['xxx', 'hide,wipe']],
102 \ 'buftype': [['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help',
103 \ 'terminal', 'prompt', 'popup'],
104 \ ['xxx', 'help,nofile']],
105 \ 'casemap': [['', 'internal', 'keepascii', 'internal,keepascii'],
106 \ ['xxx']],
Millya9c6f902024-10-06 16:47:02 +0200107 \ 'cedit': [['', '^Y', '^@', '<Esc>', '<t_xx>'],
Millycc15bbc2024-10-18 19:58:04 +0200108 \ ['xxx', 'f', '<xxx>', '<t_xxx>', '<Esc', '<t_xx']],
109 \ 'clipboard': [['', 'unnamed', 'unnamedplus', 'autoselect',
110 \ 'autoselectplus', 'autoselectml', 'html', 'exclude:vimdisplay',
111 \ 'autoselect,unnamed', 'unnamed,exclude:.*'],
112 \ ['xxx', 'exclude:\\ze*', 'exclude:\\%(']],
113 \ 'colorcolumn': [['', '8', '+2', '1,+1,+3'], ['xxx', '-a', '1,', '1;']],
114 \ 'comments': [['', 'b:#', 'b:#,:%'], ['xxx', '-']],
Riley Bruins0a083062024-06-03 20:40:45 +0200115 \ 'commentstring': [['', '/*\ %s\ */'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200116 \ 'complete': [['', '.', 'w', 'b', 'u', 'U', 'i', 'd', ']', 't',
117 \ 'k', 'kspell', 'k/tmp/dir\\\ with\\\ space/*',
118 \ 's', 's/tmp/dir\\\ with\\\ space/*',
119 \ 'w,b,k/tmp/dir\\\ with\\\ space/*,s'],
120 \ ['xxx']],
121 \ 'concealcursor': [['', 'n', 'v', 'i', 'c', 'nvic'], ['xxx']],
122 \ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup',
123 \ 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'menu,longest'],
124 \ ['xxx', 'menu,,,longest,']],
125 \ 'completeitemalign': [['abbr,kind,menu', 'menu,abbr,kind'],
126 \ ['', 'xxx', 'abbr', 'abbr,menu', 'abbr,menu,kind,abbr',
127 \ 'abbr1234,kind,menu']],
128 \ 'completepopup': [['', 'height:13', 'width:20', 'highlight:That',
129 \ 'align:item', 'align:menu', 'border:on', 'border:off',
130 \ 'width:10,height:234,highlight:Mine'],
131 \ ['xxx', 'xxx:99', 'height:yes', 'width:no', 'align:xxx',
132 \ 'border:maybe', 'border:1', 'border:']],
Bram Moolenaard4404b42019-07-28 18:38:09 +0200133 \ 'completeslash': [['', 'slash', 'backslash'], ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100134 \ 'cryptmethod': [['', 'zip'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200135 \ 'cscopequickfix': [['', 's-', 'g-', 'd-', 'c-', 't-', 'e-', 'f-', 'i-',
136 \ 'a-', 's-,c+,e0'],
137 \ ['xxx', 's,g,d']],
138 \ 'cursorlineopt': [['both', 'line', 'number', 'screenline',
139 \ 'line,number'],
140 \ ['', 'xxx', 'line,screenline']],
141 \ 'debug': [['', 'msg', 'throw', 'beep'], ['xxx']],
142 \ 'diffopt': [['', 'filler', 'context:0', 'context:999', 'iblank',
143 \ 'icase', 'iwhite', 'iwhiteall', 'horizontal', 'vertical',
144 \ 'closeoff', 'hiddenoff', 'foldcolumn:0', 'foldcolumn:12',
145 \ 'followwrap', 'internal', 'indent-heuristic', 'algorithm:myers',
146 \ 'algorithm:minimal', 'algorithm:patience',
147 \ 'algorithm:histogram', 'icase,iwhite'],
148 \ ['xxx', 'foldcolumn:xxx', 'algorithm:xxx', 'algorithm:']],
149 \ 'display': [['', 'lastline', 'truncate', 'uhex', 'lastline,uhex'],
150 \ ['xxx']],
151 \ 'eadirection': [['', 'both', 'ver', 'hor'], ['xxx', 'ver,hor']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100152 \ 'encoding': [['latin1'], ['xxx', '']],
Millycc15bbc2024-10-18 19:58:04 +0200153 \ 'eventignore': [['', 'WinEnter', 'WinLeave,winenter', 'all,WinEnter'],
154 \ ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100155 \ 'fileencoding': [['', 'latin1', 'xxx'], []],
Millycc15bbc2024-10-18 19:58:04 +0200156 \ 'fileformat': [['', 'dos', 'unix', 'mac'], ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100157 \ 'fileformats': [['', 'dos', 'dos,unix'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200158 \ 'fillchars': [['', 'stl:x', 'stlnc:x', 'vert:x', 'fold:x', 'foldopen:x',
159 \ 'foldclose:x', 'foldsep:x', 'diff:x', 'eob:x', 'lastline:x',
160 \ 'stl:\ ,vert:\|,fold:\\,diff:x'],
161 \ ['xxx', 'vert:']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100162 \ 'foldclose': [['', 'all'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200163 \ 'foldmethod': [['manual', 'indent', 'expr', 'marker', 'syntax', 'diff'],
164 \ ['', 'xxx', 'expr,diff']],
165 \ 'foldopen': [['', 'all', 'block', 'hor', 'insert', 'jump', 'mark',
166 \ 'percent', 'quickfix', 'search', 'tag', 'undo', 'hor,jump'],
167 \ ['xxx']],
168 \ 'foldmarker': [['((,))'], ['', 'xxx', '{{{,']],
169 \ 'formatoptions': [['', 't', 'c', 'r', 'o', '/', 'q', 'w', 'a', 'n', '2',
170 \ 'v', 'b', 'l', 'm', 'M', 'B', '1', ']', 'j', 'p', 'vt', 'v,t'],
171 \ ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100172 \ 'guicursor': [['', 'n:block-Cursor'], ['xxx']],
Bram Moolenaar17471e82017-11-26 23:47:18 +0100173 \ 'guifont': [['', fontname], []],
174 \ 'guifontwide': [['', fontname], []],
175 \ 'guifontset': [['', fontname], []],
Millycc15bbc2024-10-18 19:58:04 +0200176 \ 'guioptions': [['', '!', 'a', 'P', 'A', 'c', 'd', 'e', 'f', 'i', 'm',
177 \ 'M', 'g', 't', 'T', 'r', 'R', 'l', 'L', 'b', 'h', 'v', 'p', 'F',
178 \ 'k', '!abvR'],
179 \ ['xxx', 'a,b']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100180 \ 'helplang': [['', 'de', 'de,it'], ['xxx']],
181 \ 'highlight': [['', 'e:Error'], ['xxx']],
Bram Moolenaar86e57922017-04-23 18:44:26 +0200182 \ 'imactivatekey': [['', 'S-space'], ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100183 \ 'isfname': [['', '@', '@,48-52'], ['xxx', '@48']],
184 \ 'isident': [['', '@', '@,48-52'], ['xxx', '@48']],
185 \ 'iskeyword': [['', '@', '@,48-52'], ['xxx', '@48']],
186 \ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']],
Yegappan Lakshmanan87018252023-09-20 20:20:04 +0200187 \ 'jumpoptions': [['', 'stack'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200188 \ 'keymap': [['', 'accents'], ['/']],
189 \ 'keymodel': [['', 'startsel', 'stopsel', 'startsel,stopsel'], ['xxx']],
Bram Moolenaar63a2e362022-11-23 20:20:18 +0000190 \ 'keyprotocol': [['', 'xxx:none', 'yyy:mok2', 'zzz:kitty'],
Millycc15bbc2024-10-18 19:58:04 +0200191 \ ['xxx', ':none', 'xxx:', 'x:non', 'y:mok3', 'z:kittty']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100192 \ 'langmap': [['', 'xX', 'aA,bB'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200193 \ 'lispoptions': [['', 'expr:0', 'expr:1'], ['xxx', 'expr:x', 'expr:']],
194 \ 'listchars': [['', 'eol:x', 'tab:xy', 'tab:xyz', 'space:x',
195 \ 'multispace:xxxy', 'lead:x', 'leadmultispace:xxxy', 'trail:x',
196 \ 'extends:x', 'precedes:x', 'conceal:x', 'nbsp:x', 'eol:\\x24',
197 \ 'eol:\\u21b5', 'eol:\\U000021b5', 'eol:x,space:y'],
198 \ ['xxx', 'eol:']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100199 \ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200200 \ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']],
201 \ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'],
202 \ ['xxx', 'n,v,i']],
203 \ 'mousemodel': [['', 'extend', 'popup', 'popup_setpos'], ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100204 \ 'mouseshape': [['', 'n:arrow'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200205 \ 'nrformats': [['', 'alpha', 'octal', 'hex', 'bin', 'unsigned', 'blank',
206 \ 'alpha,hex,bin'],
207 \ ['xxx']],
208 \ 'patchmode': [['', 'xxx', '.x'], [&backupext, '*']],
209 \ 'previewpopup': [['', 'height:13', 'width:20', 'highlight:That',
210 \ 'align:item', 'align:menu', 'border:on', 'border:off',
211 \ 'width:10,height:234,highlight:Mine'],
212 \ ['xxx', 'xxx:99', 'height:yes', 'width:no', 'align:xxx',
213 \ 'border:maybe', 'border:1', 'border:']],
214 \ 'printmbfont': [['', 'r:some', 'b:some', 'i:some', 'o:some', 'c:yes',
215 \ 'c:no', 'a:yes', 'a:no', 'b:Bold,c:yes'],
216 \ ['xxx', 'xxx,c:yes', 'xxx:', 'xxx:,c:yes']],
217 \ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'],
218 \ ['xxx', 'header:-1']],
219 \ 'scrollopt': [['', 'ver', 'hor', 'jump', 'ver,hor'], ['xxx']],
Bram Moolenaar0c1e3742019-12-27 13:49:24 +0100220 \ 'renderoptions': [[''], ['xxx']],
Yegappan Lakshmanan5da901b2023-02-27 12:47:47 +0000221 \ 'rightleftcmd': [['search'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200222 \ 'rulerformat': [['', 'xxx'], ['%-', '%(', '%15(%%']],
223 \ 'selection': [['old', 'inclusive', 'exclusive'], ['', 'xxx']],
224 \ 'selectmode': [['', 'mouse', 'key', 'cmd', 'key,cmd'], ['xxx']],
225 \ 'sessionoptions': [['', 'blank', 'curdir', 'sesdir',
226 \ 'help,options,slash'],
227 \ ['xxx', 'curdir,sesdir']],
228 \ 'showcmdloc': [['', 'last', 'statusline', 'tabline'], ['xxx']],
229 \ 'signcolumn': [['', 'auto', 'no', 'yes', 'number'], ['xxx', 'no,yes']],
Milly322ad0c2024-10-14 20:21:48 +0200230 \ 'spellfile': [['', 'file.en.add', 'xxx.en.add,yyy.gb.add,zzz.ja.add',
231 \ '/tmp/dir\ with\ space/en.utf-8.add',
232 \ '/tmp/dir\\,with\\,comma/en.utf-8.add'],
Millycc15bbc2024-10-18 19:58:04 +0200233 \ ['xxx', '/tmp/file', '/tmp/dir*with:invalid?char/file.en.add',
234 \ ',file.en.add', 'xxx,yyy.en.add', 'xxx.en.add,yyy,zzz.ja.add']],
Bram Moolenaar9a061cb2019-05-05 16:55:03 +0200235 \ 'spelllang': [['', 'xxx', 'sr@latin'], ['not&lang', "that\\\rthere"]],
Bram Moolenaar362b44b2020-06-10 21:47:00 +0200236 \ 'spelloptions': [['', 'camel'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200237 \ 'spellsuggest': [['', 'best', 'double', 'fast', '100', 'timeout:100',
238 \ 'timeout:-1', 'file:/tmp/file', 'expr:Func()', 'double,33'],
239 \ ['xxx', '-1', 'timeout:', 'best,double', 'double,fast']],
240 \ 'splitkeep': [['', 'cursor', 'screen', 'topline'], ['xxx']],
241 \ 'statusline': [['', 'xxx'], ['%$', '%{', '%{%', '%{%}', '%(', '%)']],
Yegappan Lakshmanan5da901b2023-02-27 12:47:47 +0000242 \ 'swapsync': [['', 'sync', 'fsync'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200243 \ 'switchbuf': [['', 'useopen', 'usetab', 'split', 'vsplit', 'newtab',
244 \ 'uselast', 'split,newtab'],
245 \ ['xxx']],
246 \ 'tabclose': [['', 'left', 'uselast', 'left,uselast'], ['xxx']],
247 \ 'tabline': [['', 'xxx'], ['%$', '%{', '%{%', '%{%}', '%(', '%)']],
248 \ 'tagcase': [['followic', 'followscs', 'ignore', 'match', 'smart'],
249 \ ['', 'xxx', 'smart,match']],
Bram Moolenaar17471e82017-11-26 23:47:18 +0100250 \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200251 \ 'termwinkey': [['', 'f', '^Y', '^@', '<Esc>', '<t_xx>', "\u3042", '<',
252 \ '^'],
253 \ ['<xxx>', '<t_xxx>', '<Esc', '<t_xx']],
254 \ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'],
255 \ ['xxx', '80', '8ax9', '24x80b']],
Bram Moolenaarc6ddce32019-02-08 12:47:03 +0100256 \ 'termwintype': [['', 'winpty', 'conpty'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200257 \ 'titlestring': [['', 'xxx', '%('], []],
258 \ 'toolbar': [['', 'icons', 'text', 'horiz', 'tooltips', 'icons,text'],
259 \ ['xxx']],
260 \ 'toolbariconsize': [['', 'tiny', 'small', 'medium', 'large', 'huge',
261 \ 'giant'],
262 \ ['xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100263 \ 'ttymouse': [['', 'xterm'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200264 \ 'varsofttabstop': [['8', '4,8,16,32'], ['xxx', '-1', '4,-1,20', '1,']],
265 \ 'vartabstop': [['8', '4,8,16,32'], ['xxx', '-1', '4,-1,20', '1,']],
266 \ 'verbosefile': [['', './Xfile'], []],
267 \ 'viewoptions': [['', 'cursor', 'folds', 'options', 'localoptions',
268 \ 'slash', 'unix', 'curdir', 'unix,slash'], ['xxx']],
269 \ 'viminfo': [['', '''50', '"30', "'100,<50,s10,h"], ['xxx', 'h']],
270 \ 'virtualedit': [['', 'block', 'insert', 'all', 'onemore', 'none',
271 \ 'NONE', 'all,block'],
272 \ ['xxx']],
273 \ 'whichwrap': [['', 'b', 's', 'h', 'l', '<', '>', '~', '[', ']', 'b,s',
274 \ 'bs'],
275 \ ['xxx']],
276 \ 'wildmode': [['', 'full', 'longest', 'list', 'lastused', 'list:full',
277 \ 'full,longest', 'full,full,full,full'],
278 \ ['xxx', 'a4', 'full,full,full,full,full']],
Yegappan Lakshmanan38b85cb2022-02-24 13:28:41 +0000279 \ 'wildoptions': [['', 'tagfile', 'pum', 'fuzzy'], ['xxx']],
Millycc15bbc2024-10-18 19:58:04 +0200280 \ 'winaltkeys': [['no', 'yes', 'menu'], ['', 'xxx']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100281 \
Millycc15bbc2024-10-18 19:58:04 +0200282 "\ skipped options
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100283 \ 'luadll': [[], []],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100284 \ 'perldll': [[], []],
285 \ 'pythondll': [[], []],
286 \ 'pythonthreedll': [[], []],
287 \ 'pyxversion': [[], []],
288 \ 'rubydll': [[], []],
289 \ 'tcldll': [[], []],
Millycc15bbc2024-10-18 19:58:04 +0200290 \ 'term': [[], []],
291 \ 'ttytype': [[], []],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100292 \
Millycc15bbc2024-10-18 19:58:04 +0200293 "\ default behaviours
Bram Moolenaara12e4032017-02-25 21:37:57 +0100294 \ 'othernum': [[-1, 0, 100], ['']],
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100295 \ 'otherstring': [['', 'xxx'], []],
296 \}
297
Millyb498c442024-10-17 21:05:31 +0200298const invalid_options = test_values->keys()
299 \->filter({-> v:val !~# '^other' && !exists($"&{v:val}")})
300if !empty(invalid_options)
301 throw $"Invalid option name in test_values: '{invalid_options->join("', '")}'"
302endif
303
Bram Moolenaar2f5463d2017-02-25 20:40:46 +01003041
305/struct vimoption options
306while 1
307 /{"
308 if line('.') > end
309 break
310 endif
311 let line = getline('.')
312 let name = substitute(line, '.*{"\([^"]*\)".*', '\1', '')
313 let shortname = substitute(line, '.*"\([^"]*\)".*', '\1', '')
314
315 if has_key(test_values, name)
316 let a = test_values[name]
317 elseif line =~ 'P_NUM'
318 let a = test_values['othernum']
319 else
320 let a = test_values['otherstring']
321 endif
322 if len(a[0]) > 0 || len(a[1]) > 0
Millycc15bbc2024-10-18 19:58:04 +0200323 if name == 'browsedir'
324 call add(script, 'call mkdir("Xdir with space")')
325 endif
326
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100327 if line =~ 'P_BOOL'
328 call add(script, 'set ' . name)
329 call add(script, 'set ' . shortname)
330 call add(script, 'set no' . name)
331 call add(script, 'set no' . shortname)
332 else
333 for val in a[0]
334 call add(script, 'set ' . name . '=' . val)
335 call add(script, 'set ' . shortname . '=' . val)
336 endfor
Bram Moolenaarc43a8b82017-02-25 21:12:29 +0100337
338 " setting an option can only fail when it's implemented.
339 call add(script, "if exists('+" . name . "')")
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100340 for val in a[1]
Bram Moolenaar28ee8922020-10-28 20:20:00 +0100341 call add(script, "silent! call assert_fails('set " . name . "=" . val . "')")
342 call add(script, "silent! call assert_fails('set " . shortname . "=" . val . "')")
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100343 endfor
Bram Moolenaarc43a8b82017-02-25 21:12:29 +0100344 call add(script, "endif")
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100345 endif
346
Bram Moolenaar17471e82017-11-26 23:47:18 +0100347 " cannot change 'termencoding' in GTK
348 if name != 'termencoding' || !has('gui_gtk')
349 call add(script, 'set ' . name . '&')
350 call add(script, 'set ' . shortname . '&')
351 endif
Millycc15bbc2024-10-18 19:58:04 +0200352 if name == 'browsedir'
353 call add(script, 'call delete("Xdir with space", "d")')
354 elseif name == 'verbosefile'
355 call add(script, 'call delete("Xfile")')
Bram Moolenaarb4c55722017-03-19 19:11:35 +0100356 endif
Bram Moolenaar65408f72017-03-07 21:31:27 +0100357
358 if name == 'more'
359 call add(script, 'set nomore')
Bram Moolenaarbb962262017-03-08 00:01:35 +0100360 elseif name == 'lines'
361 call add(script, 'let &lines = save_lines')
Bram Moolenaar65408f72017-03-07 21:31:27 +0100362 endif
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100363 endif
364endwhile
365
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100366call add(script, 'let &columns = save_columns')
367call add(script, 'let &lines = save_lines')
368
Bram Moolenaare8512d72017-03-07 22:33:32 +0100369call writefile(script, 'opt_test.vim')
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100370
Millyb498c442024-10-17 21:05:31 +0200371" Write error messages if error occurs.
Millyd4ad4c92024-10-06 16:27:28 +0200372catch
Millyb498c442024-10-17 21:05:31 +0200373 " Append errors to test.log
374 let error = $'Error: {v:exception} in {v:throwpoint}'
375 echoc error
376 split test.log
377 call append('$', error)
378 write
Millyd4ad4c92024-10-06 16:27:28 +0200379endtry
380
Bram Moolenaar5b3af142017-02-27 22:59:40 +0100381endif
382
Bram Moolenaar2f5463d2017-02-25 20:40:46 +0100383qa!