" development/tests/test-calendar-vim-optout.vim — driven by test-calendar-vim.sh. " " Asserts that the calendar-vim integration stays OFF when the user opts out " (g:nuwiki_use_calendar = 0 or g:nuwiki_no_calendar = 1). In that case the " FileType autocmd must leave calendar-vim's own defaults untouched, so the " hooks still point at 'calendar#diary' / 'calendar#sign' (set by the stub). let s:results = [] let s:pass = 0 let s:fail = 0 let s:out = $NUWIKI_CALENDAR_RESULTS function! s:record(ok, name, detail) abort let l:line = (a:ok ? 'PASS' : 'FAIL') . ' ' . a:name if a:detail !=# '' let l:line .= ' — ' . a:detail endif call add(s:results, l:line) if a:ok let s:pass += 1 else let s:fail += 1 endif endfunction " The buffer is already a loaded vimwiki file (FileType has fired). nuwiki must " NOT have rewired the hooks — they should still be calendar-vim's defaults. call s:record(&filetype ==# 'vimwiki', 'ftplugin.attached', \ &filetype ==# 'vimwiki' ? '' : 'filetype=' . &filetype) call s:record(get(g:, 'calendar_action', '') !=# 'vimwiki#diary#calendar_action', \ 'optout.action_not_wired', \ 'g:calendar_action=' . get(g:, 'calendar_action', '')) call s:record(get(g:, 'calendar_sign', '') !=# 'vimwiki#diary#calendar_sign', \ 'optout.sign_not_wired', \ 'g:calendar_sign=' . get(g:, 'calendar_sign', '')) call add(s:results, '') call add(s:results, printf('SUMMARY: %d passed, %d failed', s:pass, s:fail)) call writefile(s:results, s:out) execute (s:fail == 0 ? 'qall!' : 'cquit!')