" Test for options
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 j
call assert_notequal('option-window', bufname(''))
wincmd k
call assert_equal('option-window', bufname(''))
" close option-window
close
" Open the option-window vertically.
vert options
" Check if the option-window is opened vertically.
wincmd l
call assert_notequal('option-window', bufname(''))
wincmd h
call assert_equal('option-window', bufname(''))
" close option-window
close
" Open the option-window at the top.
set splitbelow
topleft options
call assert_equal(1, winnr())
close
" Open the option-window at the bottom.
set nosplitbelow
botright options
call assert_equal(winnr('$'), winnr())
close
set splitbelow&
" Open the option-window in a new tab.
tab options
" Check if the option-window is opened in a tab.
normal gT
call assert_notequal('option-window', bufname(''))
normal gt
call assert_equal('option-window', bufname(''))
" close option-window
close
" Open the options window browse
if has('browse')
browse set
call assert_equal('option-window', bufname(''))
close
endif
endfunc
func Test_path_keep_commas()
" Test that changing 'path' keeps two commas.
set path=foo,,bar
set path-=bar
|