commit 22fd036804dd9d2302e885d61d1cba1683d84165
parent 88620a2be0d47e74639b15c71f7e170bb3b2d432
Author: Joe Planisky <joe@strangeprojector.com>
Date: Tue, 20 Jun 2023 16:15:18 -0400
Add new Vader test for issue 1326 (duplicate tags)
Diffstat:
1 file changed, 47 insertions(+), 0 deletions(-)
diff --git a/test/issue_1326_duplicate_tag_generation.vader b/test/issue_1326_duplicate_tag_generation.vader
@@ -0,0 +1,47 @@
+# Tests for issue: 1326
+# Multiple discrete tags on one line
+# cause duplicate entries in .vimwiki_tags
+# For example, this line:
+# :tag1:tag2:
+# gives correct results in .vimwiki_tags when VimwikiRebuildTags is called.
+# This line
+# :tag3: :tag4:
+# gives duplicate entries for tag4.
+
+Execute (Start with no content or .vimwiki_tags files - Start issue 1326 test):
+ call system("rm $HOME/testwiki/.vimwiki_tags")
+ call system("rm $HOME/testwiki/Test-Tag-issue-1326.wiki")
+
+Do (Create file with tags and rebuild all tags):
+ :edit! $HOME/testwiki/Test-Tag-issue-1326.wiki\<CR>
+ I
+ :discrete1: :discrete2:\<CR>
+ :concat1:concat2:\<CR>
+ \<Esc>
+ :write\<CR>
+ :VimwikiRebuildTags!\<CR>
+
+Execute (Examine .vimwiki_tags file for generated tag entries.):
+ edit $HOME/testwiki/.vimwiki_tags
+ AssertEqual $HOME . '/testwiki/.vimwiki_tags', expand('%')
+ AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
+ AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
+
+# For each tag, make sure it is found
+# once and ONLY once in the .vimwiki_tags file.
+ AssertNotEqual 0, search('concat1', 'we'), 'Expected tag "concat1" was not found.'
+ AssertEqual search('concat1', 'we'), search('concat1', 'we'), 'More than 1 instance of tag "concat1" found'
+
+ AssertNotEqual 0, search('concat2', 'we'), 'Expected tag "concat2" was not found.'
+ AssertEqual search('concat2', 'we'), search('concat2', 'we'), 'More than 1 instance of tag "concat2" found'
+
+ AssertNotEqual 0, search('discrete1', 'we'), 'Expected tag "discrete1" was not found.'
+ AssertEqual search('discrete1', 'we'), search('discrete1', 'we'), 'More than 1 instance of tag "discrete1" found'
+
+ AssertNotEqual 0, search('discrete2', 'we'), 'Expected tag "discrete2" was not found.'
+ AssertEqual search('discrete2', 'we'), search('discrete2', 'we'), 'More than 1 instance of tag "discrete2" found'
+
+Execute (Remove content and tags files - End issue 1326 test):
+ call system("rm $HOME/testmarkdown/.vimwiki_tags")
+ call system("rm $HOME/testmarkdown/Test-Tag-issue-1326.wiki")
+