e3f28d7dfc
Both editor harnesses now emit diagnostic.link_severity and exercise a
non-default override ('error') in the sample scenario, diffed against the
shared golden. Drop the README "not wired" caveat now that the value flows
through, and document the g:nuwiki_link_severity global.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
55 lines
1.9 KiB
VimL
55 lines
1.9 KiB
VimL
" development/tests/test-config-vim.vim — Vim counterpart of
|
|
" test-config.lua. Dumps the Vim client's `initialization_options` payload
|
|
" (nuwiki#lsp#settings()) for the same two scenarios as the Neovim harness,
|
|
" as byte-identical `key=value` lines, so both can be diffed against the
|
|
" shared golden development/tests/config-expected.txt.
|
|
"
|
|
" "nvim == golden" and "vim == golden" together prove Vim/Neovim config
|
|
" parity for everything the server consumes.
|
|
|
|
let s:out = $NUWIKI_CONFIG_OUT
|
|
let s:lines = []
|
|
|
|
function! s:dump(payload) abort
|
|
call add(s:lines, 'wiki_root=' . a:payload.wiki_root)
|
|
call add(s:lines, 'file_extension=' . a:payload.file_extension)
|
|
call add(s:lines, 'syntax=' . a:payload.syntax)
|
|
call add(s:lines, 'log_level=' . a:payload.log_level)
|
|
if has_key(a:payload, 'diagnostic')
|
|
call add(s:lines, 'diagnostic.link_severity=' . a:payload.diagnostic.link_severity)
|
|
endif
|
|
if has_key(a:payload, 'wikis')
|
|
let l:i = 0
|
|
for l:w in a:payload.wikis
|
|
for l:k in sort(keys(l:w))
|
|
call add(s:lines, printf('wikis[%d].%s=%s', l:i, l:k, l:w[l:k]))
|
|
endfor
|
|
let l:i += 1
|
|
endfor
|
|
endif
|
|
endfunction
|
|
|
|
" Scenario 1: defaults (no globals set).
|
|
unlet! g:nuwiki_wiki_root g:nuwiki_file_extension g:nuwiki_syntax
|
|
unlet! g:nuwiki_log_level g:nuwiki_wikis g:nuwiki_link_severity
|
|
call add(s:lines, '[default]')
|
|
call s:dump(nuwiki#lsp#settings())
|
|
|
|
" Scenario 2: same representative config as the Neovim harness.
|
|
let g:nuwiki_wiki_root = '/tmp/base'
|
|
let g:nuwiki_file_extension = '.md'
|
|
let g:nuwiki_syntax = 'vimwiki'
|
|
let g:nuwiki_log_level = 'debug'
|
|
let g:nuwiki_link_severity = 'error'
|
|
let g:nuwiki_wikis = [
|
|
\ { 'name': 'personal', 'root': '/tmp/personal',
|
|
\ 'file_extension': '.wiki', 'index': 'home',
|
|
\ 'diary_rel_path': 'journal' },
|
|
\ { 'name': 'work', 'root': '/tmp/work' },
|
|
\ ]
|
|
call add(s:lines, '[sample]')
|
|
call s:dump(nuwiki#lsp#settings())
|
|
|
|
call writefile(s:lines, s:out)
|
|
qall!
|