vim-patch:9.1.0805: tests: minor issues in gen_opt_test.vim

Problem:  tests: minor issues in gen_opt_test.vim
Solution: fix restore value for 'undolevels', fix comment, fix
          wrong cpo value, add equality test for global-local options on
          switchback (Milly).

closes: vim/vim#15913

231480f975

Cherry-pick gen_opt_test.vim change from patch 9.1.0807.

Co-authored-by: Milly <milly.ca@gmail.com>
This commit is contained in:
zeertzjq
2024-10-23 07:26:45 +08:00
parent 4ad4225bdb
commit da45827787

View File

@@ -25,7 +25,7 @@ endwhile
call extend(global_locals, #{ call extend(global_locals, #{
\ scrolloff: -1, \ scrolloff: -1,
\ sidescrolloff: -1, \ sidescrolloff: -1,
\ undolevels: -12345, \ undolevels: -123456,
\}) \})
" Get local-noglobal options. " Get local-noglobal options.
@@ -63,7 +63,8 @@ let skip_setglobal_reasons = #{
\ winhighlight: 'TODO(nvim): fix missing error handling for setglobal', \ winhighlight: 'TODO(nvim): fix missing error handling for setglobal',
\} \}
" The terminal size is restored at the end. " Script header.
" The test values contains multibyte characters.
let script = [ let script = [
\ '" DO NOT EDIT: Generated with gen_opt_test.vim', \ '" DO NOT EDIT: Generated with gen_opt_test.vim',
\ '" Used by test_options_all.vim.', \ '" Used by test_options_all.vim.',
@@ -453,8 +454,9 @@ for option in options
endfor endfor
" Testing to clear the local value and switch back to the global value. " Testing to clear the local value and switch back to the global value.
if global_locals->has_key(fullname) if global_locals->has_key(fullname)
let swichback_val = global_locals[fullname] let switchback_val = global_locals[fullname]
call add(script, $'setlocal {opt}={swichback_val}') call add(script, $'setlocal {opt}={switchback_val}')
call add(script, $'call assert_equal(&g:{fullname}, &{fullname})')
endif endif
endfor endfor
@@ -516,4 +518,4 @@ endif
qa! qa!
" vim:sw=2:ts=8:noet:nolist:nosta: " vim:sw=2:ts=8:noet:nosta: