vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 4f674f68b4f2e017e640bc19c0e040bde6987f56
parent 5ce7c14a3dfda641a9444979a447175712072944
Author: Rane Brown <rane.brown@gmail.com>
Date:   Thu, 22 Aug 2019 05:48:20 -0600

Fix the method for changing the Vimwiki syntax for tests.

This change ensures the syntax is properly changed when running multiple
tests by removing the previously created temporary wiki and then
creating a new one.

Diffstat:
Mtest/vader_includes/vader_setup.vader | 22+++++++++++++++-------
Mtest/vader_includes/vader_teardown.vader | 3+--
2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/test/vader_includes/vader_setup.vader b/test/vader_includes/vader_setup.vader @@ -1,7 +1,3 @@ -Execute (Setup): - " assumes 3 registered wikis in vimrc - let g:wiki_nr = 3 - Before (Define functions): " change the syntax using a temporary wiki function! SetSyntax(vw_syn) @@ -21,9 +17,21 @@ Before (Define functions): \ 'ext': ext, \ 'syntax': a:vw_syn, \ } + + " Remove any temporary wikis each time this function is called. + " This is necessary to ensure syntax is properly set when running multiple tests + " NOTE: this assumes there are 3 defined wikis in the vimrc. The last wiki + " contains default settings for temporary wikis (so there are always + " num wikis in vimrc + 1) + let num_wikis = len(g:vimwiki_wikilocal_vars) + while num_wikis > 4 + call remove(g:vimwiki_wikilocal_vars, num_wikis - 1) + let num_wikis = num_wikis - 1 + endwhile + + " add the new wiki call vimwiki#vars#add_temporary_wiki(new_temp_wiki_settings) - call vimwiki#vars#set_bufferlocal('wiki_nr', g:wiki_nr) - let g:wiki_nr += 1 + call vimwiki#vars#set_bufferlocal('wiki_nr', 3) " verify syntax was set correctly Assert vimwiki#vars#get_wikilocal('syntax') ==# a:vw_syn, 'ERROR: Vimwiki syntax not set correctly.' @@ -34,7 +42,7 @@ Before (Define functions): " clear mappings so plugin can be reloaded " this is needed if running manually multiple times nmapclear - + unlet g:loaded_vimwiki source plugin/vimwiki.vim endfunction diff --git a/test/vader_includes/vader_teardown.vader b/test/vader_includes/vader_teardown.vader @@ -1,4 +1,3 @@ -Execute (Cleanup): +After (Cleanup): delfunction SetSyntax delfunction ReloadVimwiki - unlet g:wiki_nr