" Test for options
source shared.vim
source check.vim
source view_util.vim
func Test_whichwrap()
set whichwrap=b,s
call assert_equal('b,s', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap+=h,l
call assert_equal('b,s,h,l', &whichwrap)
set whichwrap=h,h
call assert_equal('h', &whichwrap)
set whichwrap=h,h,h
call assert_equal('h', &whichwrap)
" For compatibility with Vim 3.0 and before, number values are also
" supported for 'whichwrap'
set whichwrap=1
call assert_equal('b', &whichwrap)
set whichwrap=2
call assert_equal('s', &whichwrap)
set whichwrap=4
call assert_equal('h,l', &whichwrap)
set whichwrap=8
call assert_equal('<,>', &whichwrap)
set whichwrap=16
call assert_equal('[,]', &whichwrap)
set whichwrap=31
call assert_equal('b,s,h,l,<,>,[,]', &whichwrap)
set whichwrap&
endfunc
func Test_isfname()
" This used to cause Vim to access uninitialized memory.
set isfname=
call assert_equal("~X", expand("~X"))
set isfname&
endfunc
" Test for getting the value of 'pastetoggle'
func Test_pastetoggle()
" character with K_SPECIAL byte
let &pastetoggle = '…'
call assert_equal('…', &pastetoggle)
call assert_equal("\n pastetoggle=…", execute('set pastetoggle?'))
" modified character with K_SPECIAL byte
let &pastetoggle = '<M-…>'
call assert_equal('<M-…>', &pastetoggle)
call assert_equal("\n pastetoggle=<M-…>", execute('set pastetoggle?'))
" illegal bytes
let str = ":\x7f:\x80:\x90:\xd0:"
let &pastetoggle = str
call assert_equal(str, &pastetoggle)
call assert_equal("\n pastetoggle=" .. strtrans(str), execute('set pastetoggle?'))
unlet str
set pastetoggle&
endfunc
func Test_wildchar()
" Empty 'wildchar' used to access invalid memory.
call assert_fails('set wildchar=', 'E521:')
call assert_fails('set wildchar=abc', 'E521:')
set wildchar=<Esc>
let a=execute('set wildchar?')
call assert_equal("\n wildchar=<Esc>", a)
set wildchar=27
let a=execute('set wildchar?')
call assert_equal("\n wildchar=<Esc>", a)
set wildchar&
endfunc
func Test_wildoptions()
set wildoptions=
set wildoptions+=tagfile
set wildoptions+=tagfile
call assert_equal('tagfile', &wildoptions)
endfunc
func Test_options_command()
let caught = 'ok'
try
options
catch
let caught = v:throwpoint . "\n" . v:exception
endtry
call assert_equal('ok', caught)
" Check if the option-window is opened horizontally.
wincmd