robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1" Script to generate test/old/testdir/opt_test.vim from src/nvim/options.lua 2" and runtime/doc/options.txt 3 4set cpo & vim 5 6" Only do this when build with the +eval feature. 7if 1 8 9try 10 11set nomore 12 13const K_KENTER = -16715 14 15" Get global-local options. 16" "key" is full-name of the option. 17" "value" is the local value to switch back to the global value. 18b options.txt 19call cursor ( 1 , 1 ) 20let global_locals = {} 21while search ( "^'[^']*'.*\\n.*|global-local" , 'W' ) 22let fullname = getline ( '.' ) ->matchstr ( "^'\\zs[^']*" ) 23let global_locals [ fullname ] = '' 24endwhile 25call extend ( global_locals , #{ 26 \scrolloff : -1 , 27 \scrolloffpad : -1 , 28 \sidescrolloff : -1 , 29 \undolevels : -123456 , 30 \}) 31 32" Get local-noglobal options. 33" "key" is full-name of the option. 34" "value" is no used. 35b options.txt 36call cursor ( 1 , 1 ) 37let local_noglobals = {} 38while search ( "^'[^']*'.*\\n.*|local-noglobal" , 'W' ) 39let fullname = getline ( '.' ) ->matchstr ( "^'\\zs[^']*" ) 40let local_noglobals [ fullname ] = v: true 41endwhile 42 43" Options to skip `setglobal` tests. 44" "key" is full-name of the option. 45" "value" is the reason. 46let skip_setglobal_reasons = #{ 47 \iminsert : 'The global value is always overwritten by the local value' , 48 \imsearch : 'The global value is always overwritten by the local value' , 49 \} 50 51" Script header. 52" The test values contains multibyte characters. 53let script = [ 54 \'" DO NOT EDIT: Generated with gen_opt_test.vim' , 55 \'" Used by test_options_all.vim.' , 56 \'' , 57 \'scriptencoding utf-8' , 58 \] 59 60let options = luaeval ( 'loadfile("../../../src/nvim/options.lua")().options' ) 61 62" font name that works everywhere (hopefully) 63let fontname = has ( 'win32' ) ? 'fixedsys' : 'fixed' 64 65" Two lists with values: values that work and values that fail. 66" When not listed, "othernum" or "otherstring" is used. 67" When both lists are empty, skip tests for the option. 68" For boolean options, if non-empty a fixed test will be run, otherwise skipped. 69let test_values = { 70"\ Nvim-only options 71 \'channel' : [[], []], 72 \'inccommand' : [[ '' , 'nosplit' , 'split' ], [ 'xxx' ]], 73 \'mousescroll' : [[ 'ver:1' , 'hor:2' , 'ver:1,hor:2' , 'hor:1,ver:2' ], 74 \[ 'xxx' , 'ver:1,xxx' , 'hor:2,xxx' ]], 75 \'redrawdebug' : [[ '' ], [ 'xxx' ]], 76 \'shada' : [[ '' , '''50' , '"30' ], [ 'xxx' ]], 77 \'termpastefilter' : [[ 'BS' , 'HT' , 'FF' , 'ESC' , 'DEL' , 'C0' , 'C1' , 'C0,C1' ], 78 \[ 'xxx' , 'C0,C1,xxx' ]], 79 \'winborder' : [[ 'rounded' , 'none' , 'single' , 'solid' ], [ 'xxx' , 'none,solid' ]], 80 \'winhighlight' : [[ '' , 'a:b' , 'a:' , 'a:b,c:d' ], 81 \[ 'a' , ':' , ':b' , 'a:b:c' , 'a:/' , '/:b' , ',' , 'a:b,,' , 'a:b,c' ]], 82 \ 83"\ Options for which Nvim has different allowed values 84 \'backspace' : [[ 2 , '' , 'indent' , 'eol' , 'start' , 'nostop' , 85 \'eol,start' , 'indent,eol,nostop' ], 86 \[ -1 , 4 , 'xxx' ]], 87 \'buftype' : [[ '' , 'nofile' , 'nowrite' , 'acwrite' , 'quickfix' , 'help' , 88 \'prompt' ], 89 \[ 'xxx' , 'help,nofile' ]], 90 \'clipboard' : [[ '' , 'unnamed' ], [ 'xxx' , '\ze*' , 'exclude:\\%(' ]], 91 \'completeopt' : [[ '' , 'menu' , 'menuone' , 'longest' , 'preview' , 'popup' , 92 \'noinsert' , 'noselect' , 'fuzzy' , 'preinsert' , 'menu,longest' ], 93 \[ 'xxx' , 'menu,,,longest,' ]], 94 \'encoding' : [[ 'utf8' ], []], 95 \'foldcolumn' : [[ 0 , 1 , 4 , 'auto' , 'auto:1' , 'auto:9' ], [ -1 , 13 , 999 ]], 96 \'foldlevel' : [[ 0 , 100 ], [ -1 , '' ]], 97 \'highlight' : [[ & highlight ], []], 98 \'iminsert' : [[ 0 , 1 ], [ -1 , 2 , 3 , 999 ]], 99 \'imsearch' : [[ -1 , 0 , 1 ], [ -2 , 2 , 3 , 999 ]], 100 \'pumborder' : [[ 'rounded' , 'none' , 'single' , 'solid' ], [ 'xxx' , 'none,solid' ]], 101 \'signcolumn' : [[ 'auto' , 'no' , 'yes' , 'number' , 'yes:1' , 'auto:1-9' ], 102 \[ '' , 'xxx' , 'no,yes' , 'auto:0-9' , 'auto:9-1' , 'auto:1-@' ]], 103 \'writedelay' : [[ 0 , 100 ], [ -1 , '' ]], 104 \ 105"\ boolean options 106 \'termguicolors' : [ 107 \has ( 'vtp' ) && ! has ( 'vcon' ) && ! has ( 'gui_running' ) ? [] : [ 1 ], 108 \[]], 109 \ 110"\ number options 111 \'chistory' : [[ 1 , 2 , 10 , 50 ], [ 1000 , -1 ]], 112 \'cmdheight' : [[ 0 , 1 , 2 , 10 ], [ -1 ]], 113 \'cmdwinheight' : [[ 1 , 2 , 10 ], [ -1 , 0 ]], 114 \'columns' : [[ 12 , 80 , 10000 ], [ -1 , 0 , 10 ]], 115 \'conceallevel' : [[ 0 , 1 , 2 , 3 ], [ -1 , 4 , 99 ]], 116"\ 'foldcolumn': [[0, 1, 4, 12], [-1, 13, 999]], 117 \'helpheight' : [[ 0 , 10 , 100 ], [ -1 ]], 118 \'history' : [[ 0 , 1 , 100 , 10000 ], [ -1 , 10001 ]], 119"\ 'iminsert': [[0, 1, 2], [-1, 3, 999]], 120"\ 'imsearch': [[-1, 0, 1, 2], [-2, 3, 999]], 121"\ 'imstyle': [[0, 1], [-1, 2, 999]], 122 \'lhistory' : [[ 1 , 2 , 10 , 50 ], [ 1000 , -1 ]], 123 \'lines' : [[ 2 , 24 , 1000 ], [ -1 , 0 , 1 ]], 124 \'linespace' : [[ -1 , 0 , 2 , 4 , 999 ], [ '' ]], 125 \'numberwidth' : [[ 1 , 4 , 8 , 10 , 11 , 20 ], [ -1 , 0 , 21 ]], 126 \'regexpengine' : [[ 0 , 1 , 2 ], [ -1 , 3 , 999 ]], 127 \'report' : [[ 0 , 1 , 2 , 9999 ], [ -1 ]], 128 \'scroll' : [[ 0 , 1 , 2 , 15 ], [ -1 , 999 ]], 129 \'scrolljump' : [[ -100 , -1 , 0 , 1 , 2 , 15 ], [ -101 , 999 ]], 130 \'scrolloff' : [[ 0 , 1 , 8 , 999 ], [ -1 ]], 131 \'scrolloffpad' : [[ 0 , 1 , 2 , 3 ], [ -1 ]], 132 \'shiftwidth' : [[ 0 , 1 , 8 , 999 ], [ -1 ]], 133 \'sidescroll' : [[ 0 , 1 , 8 , 999 ], [ -1 ]], 134 \'sidescrolloff' : [[ 0 , 1 , 8 , 999 ], [ -1 ]], 135 \'tabstop' : [[ 1 , 4 , 8 , 12 , 9999 ], [ -1 , 0 , 10000 ]], 136 \'textwidth' : [[ 0 , 1 , 8 , 99 ], [ -1 ]], 137 \'timeoutlen' : [[ 0 , 8 , 99999 ], [ -1 ]], 138 \'titlelen' : [[ 0 , 1 , 8 , 9999 ], [ -1 ]], 139 \'updatecount' : [[ 0 , 1 , 8 , 9999 ], [ -1 ]], 140 \'updatetime' : [[ 0 , 1 , 8 , 9999 ], [ -1 ]], 141 \'verbose' : [[ -1 , 0 , 1 , 8 , 9999 ], [ '' ]], 142 \'wildchar' : [[ -1 , 0 , 100 , 'x' , '^Y' , '^@' , '<Esc>' , '<t_xx>' , '<' , '^' ], 143 \[ '' , 'xxx' , '<xxx>' , '<t_xxx>' , '<Esc' , '<t_xx' , '<C-C>' , 144 \'<NL>' , '<CR>' , K_KENTER ]], 145 \'wildcharm' : [[ -1 , 0 , 100 , 'x' , '^Y' , '^@' , '<Esc>' , '<' , '^' ], 146 \[ '' , 'xxx' , '<xxx>' , '<t_xxx>' , '<Esc' , '<t_xx' , '<C-C>' , 147 \'<NL>' , '<CR>' , K_KENTER ]], 148 \'winheight' : [[ 1 , 10 , 999 ], [ -1 , 0 ]], 149 \'winminheight' : [[ 0 , 1 ], [ -1 ]], 150 \'winminwidth' : [[ 0 , 1 , 10 ], [ -1 ]], 151 \'winwidth' : [[ 1 , 10 , 999 ], [ -1 , 0 ]], 152 \ 153"\ string options 154 \'ambiwidth' : [[ 'single' , 'double' ], [ 'xxx' ]], 155 \'background' : [[ 'light' , 'dark' ], [ 'xxx' ]], 156"\ 'backspace': [[0, 1, 2, 3, '', 'indent', 'eol', 'start', 'nostop', 157"\ " 'eol,start', 'indent,eol,nostop'], 158"\ " [-1, 4, 'xxx']], 159 \'backupcopy' : [[ 'yes' , 'no' , 'auto' ], [ '' , 'xxx' , 'yes,no' ]], 160 \'backupext' : [[ 'xxx' ], [ & patchmode , '*' ]], 161 \'belloff' : [[ '' , 'all' , 'backspace' , 'cursor' , 'complete' , 'copy' , 162 \'ctrlg' , 'error' , 'esc' , 'ex' , 'hangul' , 'insertmode' , 'lang' , 163 \'mess' , 'showmatch' , 'operator' , 'register' , 'shell' , 'spell' , 164 \'term' , 'wildmode' , 'copy,error,shell' ], 165 \[ 'xxx' ]], 166 \'breakindentopt' : [[ '' , 'min:3' , 'shift:4' , 'shift:-2' , 'sbr' , 'list:5' , 167 \'list:-1' , 'column:10' , 'column:-5' , 'min:1,sbr,shift:2' ], 168 \[ 'xxx' , 'min' , 'min:x' , 'min:-1' , 'shift:x' , 'sbr:1' , 'list:x' , 169 \'column:x' ]], 170 \'browsedir' : [[ '' , 'last' , 'buffer' , 'current' , './Xdir\ with\ space' ], 171 \[ 'xxx' ]], 172 \'bufhidden' : [[ '' , 'hide' , 'unload' , 'delete' , 'wipe' ], 173 \[ 'xxx' , 'hide,wipe' ]], 174"\ 'buftype': [['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 175"\ " 'terminal', 'prompt', 'popup'], 176"\ " ['xxx', 'help,nofile']], 177 \'casemap' : [[ '' , 'internal' , 'keepascii' , 'internal,keepascii' ], 178 \[ 'xxx' ]], 179 \'cedit' : [[ '' , '^Y' , '^@' , '<Esc>' , '<t_xx>' ], 180 \[ 'xxx' , 'f' , '<xxx>' , '<t_xxx>' , '<Esc' , '<t_xx' ]], 181"\ 'clipboard': [['', 'unnamed', 'unnamedplus', 'autoselect', 182"\ " 'autoselectplus', 'autoselectml', 'html', 'exclude:vimdisplay', 183"\ " 'autoselect,unnamed', 'unnamed,exclude:.*'], 184"\ " ['xxx', 'exclude:\\ze*', 'exclude:\\%(']], 185 \'colorcolumn' : [[ '' , '8' , '+2' , '1,+1,+3' ], [ 'xxx' , '-a' , '1,' , '1;' ]], 186 \'comments' : [[ '' , 'b:#' , 'b:#,:%' ], [ 'xxx' , '-' ]], 187 \'commentstring' : [[ '' , '/*\ %s\ */' ], [ 'xxx' ]], 188 \'complete' : [[ '' , '.' , 'w' , 'b' , 'u' , 'U' , 'i' , 'd' , ']' , 't' , 189 \'k' , 'kspell' , 'k/tmp/dir\\\ with\\\ space/*' , 190 \'s' , 's/tmp/dir\\\ with\\\ space/*' , 191 \'w,b,k/tmp/dir\\\ with\\\ space/*,s' ], 192 \[ 'xxx' ]], 193"\ 'completefuzzycollect': [['', 'keyword', 'files', 'whole_line', 194"\ " 'keyword,whole_line', 'files,whole_line', 'keyword,files,whole_line'], 195"\ " ['xxx', 'keyword,,,whole_line,']], 196 \'completeitemalign' : [[ 'abbr,kind,menu' , 'menu,abbr,kind' ], 197 \[ '' , 'xxx' , 'abbr' , 'abbr,menu' , 'abbr,menu,kind,abbr' , 198 \'abbr1234,kind,menu' ]], 199"\ 'completeopt': [['', 'menu', 'menuone', 'longest', 'preview', 'popup', 200"\ " 'popuphidden', 'noinsert', 'noselect', 'fuzzy', 'preinsert', 'menu,longest'], 201"\ " ['xxx', 'menu,,,longest,']], 202"\ 'completepopup': [['', 'height:13', 'width:20', 'highlight:That', 203"\ " 'align:item', 'align:menu', 'border:on', 'border:off', 204"\ " 'width:10,height:234,highlight:Mine'], 205"\ " ['xxx', 'xxx:99', 'height:yes', 'width:no', 'align:xxx', 206"\ " 'border:maybe', 'border:1', 'border:']], 207 \'completeslash' : [[ '' , 'slash' , 'backslash' ], [ 'xxx' ]], 208 \'concealcursor' : [[ '' , 'n' , 'v' , 'i' , 'c' , 'nvic' ], [ 'xxx' ]], 209"\ 'cryptmethod': [['', 'zip'], ['xxx']], 210"\ 'cscopequickfix': [['', 's-', 'g-', 'd-', 'c-', 't-', 'e-', 'f-', 'i-', 211"\ " 'a-', 's-,c+,e0'], 212"\ " ['xxx', 's,g,d']], 213 \'cursorlineopt' : [[ 'both' , 'line' , 'number' , 'screenline' , 214 \'line,number' ], 215 \[ '' , 'xxx' , 'line,screenline' ]], 216 \'debug' : [[ '' , 'msg' , 'throw' , 'beep' ], [ 'xxx' ]], 217 \'diffanchors' : [[ '' , "'a" , '/foo/' , "'a-1,'>,/foo,xxx/,'b,123" , 218 \'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20' , 219 \'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,' ], 220 \[ ',' , '12,,34' , 'xxx' , '123,xxx' , 221 \'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21' ]], 222 \'diffopt' : [[ '' , 'filler' , 'context:0' , 'context:999' , 'iblank' , 223 \'icase' , 'iwhite' , 'iwhiteall' , 'horizontal' , 'vertical' , 224 \'closeoff' , 'hiddenoff' , 'foldcolumn:0' , 'foldcolumn:12' , 225 \'followwrap' , 'internal' , 'indent-heuristic' , 'algorithm:myers' , 226 \'icase,iwhite' , 'algorithm:minimal' , 'algorithm:patience' , 227 \'anchor' , 'algorithm:histogram' , 'inline:none' , 'inline:simple' , 228 \'inline:char' , 'inline:word' , 'inline:char,inline:word' , 'linematch:5' ], 229 \[ 'xxx' , 'foldcolumn:' , 'foldcolumn:x' , 'foldcolumn:xxx' , 230 \'linematch:' , 'linematch:x' , 'linematch:xxx' , 'algorithm:' , 231 \'algorithm:xxx' , 'context:' , 'context:x' , 'context:xxx' , 232 \'inline:xxx' ]], 233 \'display' : [[ '' , 'lastline' , 'truncate' , 'uhex' , 'lastline,uhex' ], 234 \[ 'xxx' ]], 235 \'eadirection' : [[ 'both' , 'ver' , 'hor' ], [ 'xxx' , 'ver,hor' ]], 236"\ 'encoding': [['latin1'], ['xxx', '']], 237 \'eventignore' : [[ '' , 'WinEnter' , 'WinLeave,winenter' , 'all,WinEnter' , 'all,-WinLeave' ], 238 \[ 'xxx' ]], 239 \'eventignorewin' : [[ '' , 'WinEnter' , 'WinLeave,winenter' , 'all,WinEnter' , 'all,-WinLeave' ], 240 \[ 'xxx' , 'WinNew' ]], 241 \'fileencoding' : [[ '' , 'latin1' , 'xxx' ], []], 242 \'fileformat' : [[ 'dos' , 'unix' , 'mac' ], [ 'xxx' ]], 243 \'fileformats' : [[ '' , 'dos' , 'dos,unix' ], [ 'xxx' ]], 244 \'fillchars' : [[ '' , 'stl:x' , 'stlnc:x' , 'vert:x' , 'fold:x' , 'foldopen:x' , 245 \'foldclose:x' , 'foldsep:x' , 'diff:x' , 'eob:x' , 'lastline:x' , 246 \'trunc:_' , 'trunc:_,eob:x,trunc:_' , 247 \'stl:\ ,vert:\|,fold:\\,trunc:…,diff:x' ], 248 \[ 'xxx' , 'vert:' , 'trunc:' , "trunc:\b" ]], 249 \'foldclose' : [[ '' , 'all' ], [ 'xxx' ]], 250 \'foldmarker' : [[ '((,))' ], [ '' , 'xxx' , '{{{,' ]], 251 \'foldmethod' : [[ 'manual' , 'indent' , 'expr' , 'marker' , 'syntax' , 'diff' ], 252 \[ '' , 'xxx' , 'expr,diff' ]], 253 \'foldopen' : [[ '' , 'all' , 'block' , 'hor' , 'insert' , 'jump' , 'mark' , 254 \'percent' , 'quickfix' , 'search' , 'tag' , 'undo' , 'hor,jump' ], 255 \[ 'xxx' ]], 256 \'formatoptions' : [[ '' , 't' , 'c' , 'r' , 'o' , '/' , 'q' , 'w' , 'a' , 'n' , '2' , 257 \'v' , 'b' , 'l' , 'm' , 'M' , 'B' , '1' , ']' , 'j' , 'p' , 'vt' , 'v,t' ], 258 \[ 'xxx' ]], 259 \'guicursor' : [[ '' , 'n:block-Cursor' ], [ 'xxx' ]], 260 \'guifont' : [[ '' , fontname ], []], 261"\ 'guifontset': [['', fontname], []], 262 \'guifontwide' : [[ '' , fontname ], []], 263 \'guioptions' : [[ '' , '!' , 'a' , 'P' , 'A' , 'c' , 'd' , 'e' , 'f' , 'i' , 'm' , 264 \'M' , 'g' , 't' , 'T' , 'r' , 'R' , 'l' , 'L' , 'b' , 'h' , 'v' , 'p' , 'F' , 265 \'k' , '!abvR' ], 266 \[ 'xxx' , 'a,b' ]], 267 \'helplang' : [[ '' , 'de' , 'de,it' ], [ 'xxx' ]], 268"\ 'highlight': [['', 'e:Error'], ['xxx']], 269"\ 'imactivatekey': [['', 'S-space'], ['xxx']], 270 \'isfname' : [[ '' , '@' , '@,48-52' ], [ 'xxx' , '@48' ]], 271 \'isident' : [[ '' , '@' , '@,48-52' ], [ 'xxx' , '@48' ]], 272 \'iskeyword' : [[ '' , '@' , '@,48-52' ], [ 'xxx' , '@48' ]], 273"\ 'isprint': [['', '@', '@,48-52'], ['xxx', '@48']], 274 \'jumpoptions' : [[ '' , 'stack' ], [ 'xxx' ]], 275 \'keymap' : [[ '' , 'accents' ], [ '/' ]], 276 \'keymodel' : [[ '' , 'startsel' , 'stopsel' , 'startsel,stopsel' ], [ 'xxx' ]], 277"\ 'keyprotocol': [['', 'xxx:none', 'yyy:mok2', 'zzz:kitty'], 278"\ " ['xxx', ':none', 'xxx:', 'x:non', 'y:mok3', 'z:kittty']], 279 \'langmap' : [[ '' , 'xX' , 'aA,bB' ], [ 'xxx' ]], 280 \'lispoptions' : [[ '' , 'expr:0' , 'expr:1' ], [ 'xxx' , 'expr:x' , 'expr:' ]], 281 \'listchars' : [[ '' , 'eol:x' , 'tab:xy' , 'tab:xyz' , 'space:x' , 'lead:x' , 282 \'multispace:xxxy' , 'tab:xy,leadtab:xyz' , 'leadtab:xyz,tab:xy' , 283 \'leadmultispace:xxxy' , 'trail:x' , 'extends:x' , 'precedes:x' , 284 \'conceal:x' , 'eol:\\x24' , 'eol:\\u21b5' , 'eol:\\U000021b5' , 285 \'eol:x,space:y' , 'nbsp:x' ], 286 \[ 'xxx' , 'eol:' , 'leadtab:xyz' , 'multispace:xxxy,leadtab:xyz' , 287 \'leadmultispace:xxxy,leadtab:xyz,multispace:yyyx' ]], 288 \'matchpairs' : [[ '' , '(:)' , '(:),<:>' ], [ 'xxx' ]], 289 \'maxsearchcount' : [[ 1 , 10 , 100 , 1000 ], [ 0 , -1 , 10000 ]], 290 \'messagesopt' : [[ 'hit-enter,history:1' , 'hit-enter,history:10000' , 291 \'history:100,wait:100' , 'history:0,wait:0,progress:' , 292 \'hit-enter,history:1,wait:1,progress:c' ], 293 \[ 'xxx' , 'history:500' , 'hit-enter,history:-1' , 294 \'hit-enter,history:10001' , 'history:0,wait:10001' , 295 \'hit-enter' , 'history:10,wait:99999999999999999999' , 296 \'history:99999999999999999999,wait:10' , 'wait:10' , 297 \'history:-10' , 'history:10,wait:-10' , 298 \'history:0,wait:0,progress:a' , 'history:0,wait:0,progress:ca' ]], 299 \'mkspellmem' : [[ '10000,100,12' ], [ '' , 'xxx' , '10000,100' ]], 300 \'mouse' : [[ '' , 'n' , 'v' , 'i' , 'c' , 'h' , 'a' , 'r' , 'nvi' ], 301 \[ 'xxx' , 'n,v,i' ]], 302 \'mousemodel' : [[ 'extend' , 'popup' , 'popup_setpos' ], [ 'xxx' ]], 303 \'mouseshape' : [[ '' , 'n:arrow' ], [ 'xxx' ]], 304 \'nrformats' : [[ '' , 'alpha' , 'octal' , 'hex' , 'bin' , 'unsigned' , 'blank' , 305 \'alpha,hex,bin' ], 306 \[ 'xxx' ]], 307 \'patchmode' : [[ '' , 'xxx' , '.x' ], [ & backupext , '*' ]], 308 \'previewpopup' : [[ '' , 'height:13' , 'width:20' , 'width:10,height:234' , 309 \'border:single' , 'border:none' , 310 \'height:10,width:20,border:rounded' ], 311 \[ 'xxx' , 'xxx:99' , 'height:yes' , 'width:no' , 312 \'border:' , 'border:xxx' , 'border:on' ]], 313"\ 'printmbfont': [['', 'r:some', 'b:some', 'i:some', 'o:some', 'c:yes', 314"\ " 'c:no', 'a:yes', 'a:no', 'b:Bold,c:yes'], 315"\ " ['xxx', 'xxx,c:yes', 'xxx:', 'xxx:,c:yes']], 316"\ 'printoptions': [['', 'header:0', 'left:10pc,top:5pc'], 317"\ " ['xxx', 'header:-1']], 318"\ 'pumborder': [['', 'single', 'double', 'round', 'ascii', 'shadow', 319"\ " 'double,margin,shadow', 'custom:─;│;─;│;┌;┐;┘;└,shadow', 320"\ " 'ascii,margin'], 321"\ " ['xxx', 'margin', 'margin,shadow', 'custom:', 'custom:+;']], 322"\ 'renderoptions': [[''], ['xxx']], 323 \'rightleftcmd' : [[ 'search' ], [ 'xxx' ]], 324 \'rulerformat' : [[ '' , 'xxx' ], [ '%-' , '%(' , '%15(%%' ]], 325 \'scrollopt' : [[ '' , 'ver' , 'hor' , 'jump' , 'ver,hor' ], [ 'xxx' ]], 326 \'selection' : [[ 'old' , 'inclusive' , 'exclusive' ], [ '' , 'xxx' ]], 327 \'selectmode' : [[ '' , 'mouse' , 'key' , 'cmd' , 'key,cmd' ], [ 'xxx' ]], 328 \'sessionoptions' : [[ '' , 'blank' , 'curdir' , 'sesdir' , 329 \'help,options,slash' ], 330 \[ 'xxx' , 'curdir,sesdir' ]], 331 \'shellpipe' : [[ '' , '>' , '>%s2>&1' , '\|tee' , '\|&tee' , '2>&1\|tee' , '%%' ], 332 \[ '%s%s%s' , '%s%p%d' ]], 333 \'shellredir' : [[ '' , '>' , '>%s2>&1' , '\|tee' , '\|&tee' , '2>&1\|tee' , '%%' ], 334 \[ '%s%s%s' , '%s%p%d' ]], 335 \'showcmdloc' : [[ 'last' , 'statusline' , 'tabline' ], [ 'xxx' ]], 336"\ 'signcolumn': [['', 'auto', 'no', 'yes', 'number'], ['xxx', 'no,yes']], 337 \'spellfile' : [[ '' , 'file.en.add' , 'xxx.en.add,yyy.gb.add,zzz.ja.add' , 338 \'/tmp/dir\ with\ space/en.utf-8.add' , 339 \'/tmp/dir\\,with\\,comma/en.utf-8.add' ], 340 \[ 'xxx' , '/tmp/file' , '/tmp/dir*with:invalid?char/file.en.add' , 341 \',file.en.add' , 'xxx,yyy.en.add' , 'xxx.en.add,yyy,zzz.ja.add' ]], 342 \'spelllang' : [[ '' , 'xxx' , 'sr@latin' ], [ 'not&lang' , "that\\\rthere" ]], 343 \'spelloptions' : [[ '' , 'camel' ], [ 'xxx' ]], 344 \'spellsuggest' : [[ '' , 'best' , 'double' , 'fast' , '100' , 'timeout:100' , 345 \'timeout:-1' , 'file:/tmp/file' , 'expr:Func()' , 'double,33' ], 346 \[ 'xxx' , '-1' , 'timeout:' , 'best,double' , 'double,fast' ]], 347 \'splitkeep' : [[ 'cursor' , 'screen' , 'topline' ], [ 'xxx' ]], 348 \'statusline' : [[ '' , 'xxx' ], [ '%^' , '%{' , '%{%' , '%{%}' , '%(' , '%)' ]], 349"\ 'swapsync': [['', 'sync', 'fsync'], ['xxx']], 350 \'switchbuf' : [[ '' , 'useopen' , 'usetab' , 'split' , 'vsplit' , 'newtab' , 351 \'uselast' , 'split,newtab' ], 352 \[ 'xxx' ]], 353 \'tabclose' : [[ '' , 'left' , 'uselast' , 'left,uselast' ], [ 'xxx' ]], 354 \'tabline' : [[ '' , 'xxx' ], [ '%^' , '%{' , '%{%' , '%{%}' , '%(' , '%)' ]], 355 \'tagcase' : [[ 'followic' , 'followscs' , 'ignore' , 'match' , 'smart' ], 356 \[ '' , 'xxx' , 'smart,match' ]], 357 \'termencoding' : [ has ( 'gui_gtk' ) ? [] : [ '' , 'utf-8' ], [ 'xxx' ]], 358"\ 'termwinkey': [['', 'f', '^Y', '^@', '<Esc>', '<t_xx>', "\u3042", '<', 359"\ " '^'], 360"\ " ['<xxx>', '<t_xxx>', '<Esc', '<t_xx']], 361"\ 'termwinsize': [['', '24x80', '0x80', '32x0', '0x0'], 362"\ " ['xxx', '80', '8ax9', '24x80b']], 363"\ 'termwintype': [['', 'winpty', 'conpty'], ['xxx']], 364"\ 'titlestring': [['', 'xxx', '%('], []], 365"\ 'toolbar': [['', 'icons', 'text', 'horiz', 'tooltips', 'icons,text'], 366"\ " ['xxx']], 367"\ 'toolbariconsize': [['', 'tiny', 'small', 'medium', 'large', 'huge', 368"\ " 'giant'], 369"\ " ['xxx']], 370"\ 'ttymouse': [['', 'xterm'], ['xxx']], 371 \'varsofttabstop' : [[ '8' , '4,8,16,32' ], [ 'xxx' , '-1' , '4,-1,20' , '1,' ]], 372 \'vartabstop' : [[ '8' , '4,8,16,32' ], [ 'xxx' , '-1' , '4,-1,20' , '1,' ]], 373 \'verbosefile' : [[ '' , './Xfile' ], []], 374 \'viewoptions' : [[ '' , 'cursor' , 'folds' , 'options' , 'localoptions' , 375 \'slash' , 'unix' , 'curdir' , 'unix,slash' ], [ 'xxx' ]], 376 \'viminfo' : [[ '' , '''50' , '"30' , "'100,<50,s10,h" ], [ 'xxx' , 'h' ]], 377 \'virtualedit' : [[ '' , 'block' , 'insert' , 'all' , 'onemore' , 'none' , 378 \'NONE' , 'all,block' ], 379 \[ 'xxx' ]], 380 \'whichwrap' : [[ '' , 'b' , 's' , 'h' , 'l' , '<' , '>' , '~' , '[' , ']' , 'b,s' , 381 \'bs' ], 382 \[ 'xxx' ]], 383 \'wildmode' : [[ '' , 'full' , 'longest' , 'list' , 'lastused' , 'list:full' , 384 \'noselect' , 'noselect,full' , 'noselect:lastused,full' , 385 \'noinsert' , 'noinsert,full' , 'noinsert:lastused,full' , 386 \'full,longest' , 'full,full,full,full' ], 387 \[ 'xxx' , 'a4' , 'full,full,full,full,full' ]], 388 \'wildoptions' : [[ '' , 'tagfile' , 'pum' , 'fuzzy' ], [ 'xxx' ]], 389 \'winaltkeys' : [[ 'no' , 'yes' , 'menu' ], [ '' , 'xxx' ]], 390 \ 391"\ skipped options 392"\ 'luadll': [[], []], 393"\ 'perldll': [[], []], 394"\ 'pythondll': [[], []], 395"\ 'pythonthreedll': [[], []], 396 \'pyxversion' : [[], []], 397"\ 'rubydll': [[], []], 398"\ 'tcldll': [[], []], 399 \'term' : [[], []], 400 \'ttytype' : [[], []], 401 \ 402"\ default behaviours 403 \'othernum' : [[ -1 , 0 , 100 ], [ '' ]], 404 \'otherstring' : [[ '' , 'xxx' ], []], 405 \} 406 407" Two lists with values: values that pre- and post-processing in test. 408" Clear out t_WS: we don't want to resize the actual terminal. 409let test_prepost = { 410 \'browsedir' : [[ "call mkdir('Xdir with space', 'D')" ], []], 411 \'columns' : [[ 412 \'set t_WS=' , 413 \'let save_columns = &columns' 414 \], [ 415 \'let &columns = save_columns' , 416 \'set t_WS&' 417 \]], 418 \'lines' : [[ 419 \'set t_WS=' , 420 \'let save_lines = &lines' 421 \], [ 422 \'let &lines = save_lines' , 423 \'set t_WS&' 424 \]], 425 \'verbosefile' : [[], [ 'call delete("Xfile")' ]], 426 \} 427 428const invalid_options = test_values ->keys () 429 \->filter ({ ->v: val !~# '^other' && !exists ( $ "&{v: val } ")}) 430if ! empty ( invalid_options ) 431throw $ "Invalid option name in test_values: '{invalid_options->join("', '")}'" 432endif 433 434for option in options 435let fullname = option . full_name 436let shortname = get ( option , 'abbreviation' , fullname ) 437 438if ! exists ( '+' .. fullname ) 439continue 440endif 441 442let [ valid_values , invalid_values ] = test_values [ 443 \has_key ( test_values , fullname ) ? fullname 444 \: option . type == 'number' ? 'othernum' 445 \: 'otherstring' ] 446 447if empty ( valid_values ) && empty ( invalid_values ) 448continue 449endif 450 451call add ( script , $ "funcTest_opt_set_{fullname}()") 452call add ( script , $ "if exists('+{fullname}') && execute('set!') =~# '\\n..{fullname}\\([=\\n]\\|$\\)'") 453call add ( script , $ "letl: saved = [&g: { fullname }, & l: {fullname}]") 454call add ( script , 'endif' ) 455 456let [ pre_processing , post_processing ] = get ( test_prepost , fullname , [[], []]) 457let script += pre_processing 458 459if option . type == 'boolean' 460for opt in [ fullname , shortname ] 461for cmd in [ 'set' , 'setlocal' , 'setglobal' ] 462call add ( script , $ '{cmd} {opt}') 463call add ( script , $ '{cmd} no{opt}') 464call add ( script , $ '{cmd} inv{opt}') 465call add ( script , $ '{cmd} {opt}!') 466endfor 467endfor 468else " P_NUM || P_STRING 469" Normal tests 470for opt in [ fullname , shortname ] 471for cmd in [ 'set' , 'setlocal' , 'setglobal' ] 472for val in valid_values 473if local_noglobals ->has_key ( fullname ) && cmd ==# 'setglobal' 474" Skip `:setglobal {option}={val}` for local-noglobal option. 475" It has no effect. 476let pre = '" Skip local-noglobal: ' 477else 478let pre = '' 479endif 480call add ( script , $ '{pre}{cmd} {opt}={val}') 481endfor 482endfor 483" Testing to clear the local value and switch back to the global value. 484if global_locals ->has_key ( fullname ) 485let switchback_val = global_locals [ fullname ] 486call add ( script , $ 'setlocal {opt}={switchback_val}') 487call add ( script , $ 'call assert_equal(&g: { fullname }, & {fullname})') 488endif 489endfor 490 491" Failure tests 492" Setting an option can only fail when it's implemented. 493call add ( script , $ "if exists('+{fullname}')") 494for opt in [ fullname , shortname ] 495for cmd in [ 'set' , 'setlocal' , 'setglobal' ] 496for val in invalid_values 497if val is# global_locals ->get ( fullname , {}) && cmd ==# 'setlocal' 498" Skip setlocal switchback-value to global-local option. It will 499" not result in failure. 500let pre = '" Skip global-local: ' 501elseif local_noglobals ->has_key ( fullname ) && cmd ==# 'setglobal' 502" Skip setglobal to local-noglobal option. It will not result in 503" failure. 504let pre = '" Skip local-noglobal: ' 505elseif skip_setglobal_reasons ->has_key ( fullname ) && cmd ==# 'setglobal' 506" Skip setglobal to reasoned option. It will not result in failure. 507let reason = skip_setglobal_reasons [ fullname ] 508let pre = $ '"Skip {reason}: ' 509else 510let pre = '' 511endif 512let cmdline = $ '{cmd} {opt}={val}' 513call add ( script , $ "{pre}silent! call assert_fails({string(cmdline)})") 514endfor 515endfor 516endfor 517call add ( script , "endif" ) 518endif 519 520" Cannot change 'termencoding' in GTK 521if fullname != 'termencoding' || ! has ( 'gui_gtk' ) 522call add ( script , $ 'set {fullname}&') 523call add ( script , $ 'set {shortname}&') 524call add ( script , $ "if exists('l: saved ')") 525call add ( script , $ "let [&g: { fullname }, & l: {fullname}] =l: saved ") 526call add ( script , 'endif' ) 527endif 528 529let script += post_processing 530call add ( script , 'endfunc' ) 531endfor 532 533call writefile ( script , 'opt_test.vim' ) 534 535" Write error messages if error occurs. 536catch 537" Append errors to test.log 538let error = $ 'Error: {v: exception } in {v: throwpoint } ' 539echo error 540split gen_opt_test.log 541call append ( '$' , error ) 542write 543endtry 544 545endif 546 547qa ! 548 549" vim:sw=2:ts=8:noet:nosta: