vim-patch:9.2.0277: tests: test_modeline.vim fails (#38672)

Problem:  tests: test_modeline.vim fails (after v9.2.0276)
Solution: Rewrite the tests to use the existing s:modeline_fails()
          function, update documentation (zeertzjq).

8c8772c6b3
(cherry picked from commit 65e2218585)
This commit is contained in:
zeertzjq
2026-04-01 16:43:03 +08:00
committed by github-actions[bot]
parent c084ab9f57
commit 04fabbf32d
4 changed files with 10 additions and 25 deletions

View File

@@ -273,13 +273,16 @@ endfunc
func Test_modeline_fails_modelineexpr()
call s:modeline_fails('balloonexpr', 'balloonexpr=Something()', 'E992:')
call s:modeline_fails('complete', "complete=FSomething", 'E992:')
call s:modeline_fails('foldexpr', 'foldexpr=Something()', 'E992:')
call s:modeline_fails('foldtext', 'foldtext=Something()', 'E992:')
call s:modeline_fails('formatexpr', 'formatexpr=Something()', 'E992:')
call s:modeline_fails('guitablabel', 'guitablabel=Something()', 'E992:')
call s:modeline_fails('guitabtooltip', 'guitabtooltip=Something()', 'E992:')
call s:modeline_fails('iconstring', 'iconstring=Something()', 'E992:')
call s:modeline_fails('includeexpr', 'includeexpr=Something()', 'E992:')
call s:modeline_fails('indentexpr', 'indentexpr=Something()', 'E992:')
call s:modeline_fails('printheader', 'printheader=Something()', 'E992:')
call s:modeline_fails('rulerformat', 'rulerformat=Something()', 'E992:')
call s:modeline_fails('statusline', 'statusline=Something()', 'E992:')
call s:modeline_fails('tabline', 'tabline=Something()', 'E992:')
@@ -503,29 +506,4 @@ func Test_modeline_nowrap_lcs_extends()
set equalalways&
endfunc
func Test_modeline_forbidden()
let tempfile = tempname()
let lines =<< trim END
some test text for completion
vim: set complete=F{->system('touch_should_not_run')} :
END
call writefile(lines, tempfile, 'D')
call assert_fails($'new {tempfile}', 'E992:')
bw!
let lines =<< trim END
some text
vim: set guitabtooltip=%{%mapset()%}:
END
call writefile(lines, tempfile)
call assert_fails($'new {tempfile}', 'E992:')
bw!
let lines =<< trim END
some text
vim: set printheader=%{mapset('n',0,{})%)%}:
END
call writefile(lines, tempfile, 'D')
"call assert_fails($'new {tempfile}', 'E992:')
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab