commit 7144df6b96cc37defaa2b08a39f5b41a87614939
parent 4b041a606a10cfa496e86843afdc41b53a3e89c0
Author: Tinmarino <tinmarino@gmail.com>
Date: Sun, 9 Aug 2020 16:13:53 -0400
Test: Refactor: Normalize names and behavior
Diffstat:
26 files changed, 1636 insertions(+), 1488 deletions(-)
diff --git a/.travis.yml b/.travis.yml
@@ -24,18 +24,19 @@ env:
# Define jobs <- vim version <- hard copied from Dockerfile
# First to be launched
- VIM_VERSION=vint
- - VIM_VERSION=vim_7.3.429
+ - VIM_VERSION=vim_7.3.429
- VIM_VERSION=nvim_0.3.8
- # More
- - VIM_VERSION=vim_7.4.1099
- - VIM_VERSION=vim_7.4.1546
- - VIM_VERSION=vim_8.0.0027
- VIM_VERSION=vim_8.1.0519
+ # More
+ - VIM_VERSION=vim_7.4.1099 PATTERN='[a-k]*.vader'
+ - VIM_VERSION=vim_7.4.1546 PATTERN='l*.vader'
+ - VIM_VERSION=vim_8.0.0027 PATTERN='[m-z]*.vader'
script:
# Run All tests
- pushd test
- if [[ "$VIM_VERSION" == 'vint' ]]; then bash run_tests.sh -v -t vint;
+ elif [[ ! -z "$PATTERN" ]]; then bash run_tests.sh -v -t vader -n "$VIM_VERSION" -f "$PATTERN";
else bash run_tests.sh -v -t vader -n "$VIM_VERSION";
fi
- popd
diff --git a/test/command_generate_links.vader b/test/command_generate_links.vader
@@ -1,205 +0,0 @@
-# Automatic link generation
-# Related to:
-# - wiki file discovery
-# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
-
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-# 1 VimwikiGenerateLinks {{{1
-##########################
-# Wiki Syntax {{{2
-#################
-
-Execute (Log):
- Log 'Wiki Syntax'
-
-Given (Void):
-
-Execute (VimwikiGenerateLinks):
- edit $HOME/testwiki/Test.wiki
- VimwikiGenerateLinks
-
-Expect (The links with a header):
-
-
- = Generated Links =
- - [[buzz_bozz]]
- - [[index]]
-
-Execute (VimwikiGenerateLinks x 2):
- edit $HOME/testwiki/Test.wiki
- VimwikiGenerateLinks
- call append('$', 'Last Line')
- VimwikiGenerateLinks
-
-Expect (The links with a header (bis)):
-
-
- = Generated Links =
- - [[buzz_bozz]]
- - [[index]]
-
- Last Line
-
-Execute (Clean Test.wiki):
- call DeleteFile('$HOME/testwiki/Test.wiki')
-
-
-# Markdown Syntax {{{2
-#################
-
-Execute (Log):
- Log 'Markdown Syntax'
-
-Given (Void):
-
-Execute (Goto markdown resource wiki):
- VimwikiIndex 2
- AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
-
-Execute (Edit Test file / VimwikiGenerateLinks):
- edit $HOME/testmarkdown/Test.md
- AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
- AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
- AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
- VimwikiGenerateLinks
-
-Expect (The links with a header):
-
-
- # Generated Links
-
- - [Buzz Bozz](buzz_bozz)
- - [Test Wiki](index)
-
-Do (Save Test.md && Re-GenerateLinks):
- :edit $HOME/testmarkdown/Test.md\<CR>
- :call WriteMe()\<CR>
- :VimwikiGenerateLinks\<CR>
- :VimwikiGenerateLinks\<CR>
-
-Expect (The links with a header with file Test):
-
-
- # Generated Links
-
- - [Generated Links](Test)
- - [Buzz Bozz](buzz_bozz)
- - [Test Wiki](index)
-
-Execute (Clean: Remove Test.md):
- call DeleteFile('$HOME/testmarkdown/Test.md')
-
-
-# 2 VimwikiDiaryGenerateLinks {{{1
-#############################
-
-# Wiki Syntax {{{1
-#################
-
-Execute (Log):
- Log 'Wiki Syntax'
-
-Do (Create diary files):
- :edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
- :call append('$', 'Content')\<Cr>
- :call WriteMe()\<Cr>
- :edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
- :call append('$', 'Content')\<Cr>
- :call WriteMe()\<Cr>
- :edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
- :call append('$', 'Content')\<Cr>
- :call WriteMe()\<Cr>
-
-Do (Edit diary.wiki && GenerateDiaryLinks):
- :edit $HOME/testwiki/diary/diary.wiki\<CR>
- :VimwikiDiaryGenerateLinks\<CR>
-
-Expect (diary index generated):
- = Diary =
- == 2020 ==
-
- === July ===
- - [[2020-07-25|day 4]]
- - [[2020-07-24|day 3]]
- - [[2020-07-23|Day 2]]
- - [[2020-07-22]]
-
- == 2019 ==
-
- === December ===
- - [[2019-12-10]]
-
- === July ===
- - [[2019-07-13]]
-
- === March ===
- - [[2019-03-01]]
-
-Execute (Clean):
- Log "End: Clean"
- call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
- call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
- call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
- Log "End: Reset shiftwidth to the default: 8"
-
-# Wiki Markdown {{{1
-#################
-
-Execute (Log):
- Log 'Markdown Syntax'
-
-Execute (New Command):
- Log "2. Testing VimwikiDiaryGenerateLinks TODO"
- set sw=4
- AssertEqual 4, &sw
-
-Do (Edit diary/2019-12-10):
- :edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
- iinformative content\<Esc>
- :call WriteMe()\<CR>
-
-Do (Edit and save diary/2019-07-13):
- :edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
- i# informative title\<Esc>
- :call WriteMe()\<CR>
-
-Do (Edit and save diary/2018-03-01):
- :edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
- :call WriteMe()\<CR>
-
-
-Do (Edit diary.md && GenerateDiaryLinks):
- :edit $HOME/testmarkdown/diary/diary.md\<CR>
- :VimwikiDiaryGenerateLinks\<CR>
-
-Expect (diary index generated):
- # Diary
-
- ## 2019
-
- ### December
-
- - [2019-12-10](2019-12-10)
-
- ### July
-
- - [informative title](2019-07-13)
-
- ### March
-
- - [2019-03-01](2019-03-01)
-
-
-Execute (Clean):
- Log "End: Clean"
- call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
- call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
- call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
- Log "End: Reset shiftwidth to the default: 8"
- set sw&
-
-# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
diff --git a/test/command_goto.vader b/test/command_goto.vader
@@ -1,83 +0,0 @@
-# VimwikiGoto
-#
-# Note: I dont know why <Tab> is inserting a Tab.
-# Well better than to insert a Chair, but it should trigger completion
-# So I used C-L
-
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-
-Execute (VimwikiGoto buzz_bozz && Assert):
- VimwikiIndex 2
- VimwikiGoto buzz_bozz
- AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
-
-Do (VimwikiGoto <CR> buzz_bozz && Assert):
- :VimwikiIndex 2\<CR>
- :VimwikiGoto\<CR>
- buzz_bozz\<CR>
- :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
-
-Do (VimwikiGoto + Completion(cmdline) && Assert):
- :VimwikiIndex 2\<CR>
- :VimwikiGoto buzz_bo\<C-l>\<CR>
- :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
-
-Do (VimwikiGoto <CR> buzz_bo + Completion(input()) && Assert):
- :VimwikiIndex 2\<CR>
- :VimwikiGoto\<CR>
- buzz_bo\<C-l>\<CR>
- :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
-
-Do (,wn buzz_bo + Completion(input()) && Assert):
- ,wn
- buzz_bo\<C-l>\<CR>
- :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
-
-Execute (:VimwikiGoto + Completion (API)):
- VimwikiIndex 2
- AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
- let s_complete=string(vimwiki#base#get_globlinks_escaped())
- Assert -1 != stridx(s_complete, 'buzz_bozz')
-
-Execute (Create dir1/dir2/test_goto_file.md):
- call system("mkdir $HOME/testmarkdown/dir1")
- call system("mkdir $HOME/testmarkdown/dir1/dir2")
- edit $HOME/testmarkdown/dir1/dir2/test_goto_file.md
- call WriteMe()
-
-Execute (:VimwikiGoto + Completion in directory):
- " Return to base
- VimwikiIndex 2
- AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
-
- " Complete without argment
- let s_complete1=string(vimwiki#base#get_globlinks_escaped())
- Assert -1 != stridx(s_complete1, 'test_goto_file')
-
- " Complete with file argument
- let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
- Assert -1 != stridx(s_complete2, 'test_goto_file')
-
- " Complete with start of file argument
- let s_complete3=string(vimwiki#base#get_globlinks_escaped('test_got'))
- Assert -1 != stridx(s_complete3, 'test_goto_file')
-
- " Complete with (nested) dir2 argument
- let s_complete4=string(vimwiki#base#get_globlinks_escaped('dir2'))
- Assert -1 != stridx(s_complete4, 'test_goto_file')
-
- " Complete with bad argument
- let l_complete5=vimwiki#base#get_globlinks_escaped('this_string_is_nowhere')
- let s_complete5=string(l_complete5)
- Assert -1 == stridx(s_complete5, 'test_goto_file')
- AssertEqual 0, len(l_complete5)
-
-Execute (Clean):
- Log "End: Clean"
- call system("rm $HOME/testmarkdown/dir1")
-
-# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
diff --git a/test/command_rename_link.vader b/test/command_rename_link.vader
@@ -1,271 +0,0 @@
-# VimwikiRenameFile
-# Related to link, file navigation
-# Many commands are made with Do: They block with Execute
-
-
-# Create directories I remove at end {{{1
-##########################################
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-
-Execute (Mkdir dir1 dir2 dir11 dir12):
- call system("mkdir $HOME/testmarkdown/dir1")
- call system("mkdir $HOME/testmarkdown/dir1/dir11")
- call system("mkdir $HOME/testmarkdown/dir1/dir12")
- call system("mkdir $HOME/testmarkdown/dir2")
-
-
-# Test Transdirectory and argument {{{1
-# New feature #926
-
-# Create smaller unit {{{2
-
-# we stick all along with these 3 files,
-# Follow them !
-Execute (Create 3 files):
- edit $HOME/testmarkdown/Test-Rename-zzz.md
- call WriteMe()
- edit $HOME/testmarkdown/dir1/dir11/Test-Rename.md
- call WriteMe()
- edit $HOME/testmarkdown/Test-Rename-Completion.md
- call WriteMe()
-
-
-Do (Testing Old buffer has been wiped out {{{2):
- :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
- :let buf_old = bufnr('%')\<Cr>
- :VimwikiRenameFile Test-Rename-new1\<Cr>
- :AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr>
- :VimwikiRenameFile Test-Rename-Completion\<Cr>
- :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
-
-Do (Testing Completion {{{2):
-# Rename and test (zzz)
- :VimwikiRenameFile Test-Rename-z\<C-l>1\<Cr>
- :AssertEqual $HOME . '/testmarkdown/Test-Rename-zzz1.md', expand('%')\<CR>\<Esc>
-# Restore old name
- :call WriteMe()\<Cr>
- :VimwikiRenameFile Test-Rename-zzz\<Cr>
-
-
-Do (Testing transforward {{{2):
- :Log 'Forward: root -> dir1/dir11 {{{3'\<Cr>
-# Create dir1/dir11/Test-Rename and link to it
- :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
- ggdG
- idir1/dir11/Test-Rename.md\<Esc>
- \<Cr>\<Cr>
- :VimwikiRenameFile ../Test-Rename-2\<Cr>
- :AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-2.md'\<CR>\<Esc>
-
-# See what happend in root
- :call WriteMe()\<Cr>
- :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
- :AssertEqual getline(1), '[dir1 dir11 Test Rename](dir1/Test-Rename-2.md)'\<Cr>
-
- :Log 'Backward dir1/dir11 -> root {{{3'\<Cr>
-# See what happend in dir1/dir11
-# I am in root so pressing Enter sends me to dir1/dir11
- \<Cr>
-# Write forward path
- dd
- i../Test-Rename-Completion\<Esc>
-# Convert it to link
- 0\<Cr>\<Cr>
-
-# Now in root
- :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
- :VimwikiRenameFile dir1/Test-Rename-Completion-2\<Cr>
- :AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-Completion-2.md'\<Cr>
-
-
-Execute (Delete smaller unit changed {{{2):
- call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md')
- call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md')
- call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md')
-
-
-# VimwikiRename Test same directory {{{1
-# Old big conf, from bad unit test design
-# Changing file in a single dir
-# Feel free to modify but as long as it works
-# I delay the cleaning
-####################################
-
-Given vimwiki (Void):
-
-
-Execute (Create Test-Rename -> dir1/dir11/in_dir11.md and dir1/dir12/in_dir12.md and dir2/in_dir2.md):
- edit $HOME/testmarkdown/Test-Rename.md
- AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')
- AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
- AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
- call append(0, ['# Test Rename', 'in_root.md', 'dir1/dir11/in_dir11.md', 'dir1/dir12/in_dir12.md', 'dir2/in_dir2.md'])
- call WriteMe()
-
-Do (Create in_root):
- :Log 'Open Test-Rename.md'\<CR>
- :edit $HOME/testmarkdown/Test-Rename.md\<CR>
- :AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')\<CR>\<Esc>
-
- :Log 'Delete last line (easyer latter checks without trailing spaces)'\<CR>
- Gdd
-
- :Log 'Open in_root.md'\<CR>
- gg
- j\<CR>
- j\<CR>
- j\<CR>
- j\<CR>
- ggj0y$
- :AssertEqual '[in_root](in_root.md)', @"\<CR>
- 0\<CR>
- :AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
-
- :Log 'Add link in_root.md -> dir1/dir11/in_dir11'\<CR>
- ggi# Title in root\<CR>\<Esc>
- idir1/dir11/in_dir11\<Esc>
- :call WriteMe()\<CR>
- :AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
-
- :Log 'Open in_dir11.md: creating dirs'\<CR>
- ggj"ay$
- :AssertEqual 'reg dir1/dir11/in_dir11', 'reg ' . @a\<CR>
- 0\<CR>\<CR>
- :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
-
- :Log 'One backspace for fun'\<CR>
- \<BS>
- :AssertEqual 'file ' . $HOME . '/testmarkdown/in_root.md', 'file ' . expand('%')\<CR>
-
-
-Do (Create dir_11 -> dir_11):
- :edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md\<CR>
-
- :Log 'Add link in_dir11_fix.md -> in_dir11'\<CR>
- ggi# Title in dir11 fix\<CR>\<Esc>
- iin_dir11\<Esc>
- :call WriteMe()\<CR>
-
- :Log 'Open in_dir11.md: creating dirs'\<CR>
- ggj"ay$
- :AssertEqual 'reg in_dir11', 'reg ' . @a\<CR>
- 0\<CR>\<CR>
- y\<CR>
- :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
-
- :Log 'One backspace for fun'\<CR>
- \<BS>
- :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11_fix.md', 'file ' . expand('%')\<CR>
-
-
-Execute (Fill in_dir11 content):
- edit $HOME/testmarkdown/dir1/dir11/in_dir11.md
- call append(0, ['# Title in_dir11', '[dir2 link](../../dir2/in_dir2.md)'])
- call WriteMe()
-
-
-# Rename local {{{1
-###################
-
-Do (RenameLink in_dir11 -> in_dir11_new):
- :edit $HOME/testmarkdown/dir1/dir11/in_dir11.md\<CR>
- :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
- :AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<CR>
-
- :Log 'Rename'\<CR>
- :call WriteMe()\<CR>
- :VimwikiRenameFile\<CR>
- y\<CR>
- in_dir11_new\<CR>
- :call WriteMe()\<Cr>
-
- :Log 'Append filename'\<CR>
- :call append('$', [expand('%')])\<CR>
-
-
-Expect(With new filename at the end):
- # Title in_dir11
- [dir2 link](../../dir2/in_dir2.md)
-
- /home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
-
-
-Execute (edit in_dir11_fix):
- edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md
-
-Expect(Link to in_dir11_new):
- # Title in dir11 fix
- [in_dir11](in_dir11_new)
-
-
-Execute (edit Test-Rename.md):
- edit $HOME/testmarkdown/Test-Rename.md
-
-
-Expect (Link to in_dir11_new):
- # Test Rename
- [in_root](in_root.md)
- [dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
- [dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
- [dir2 in_dir2](dir2/in_dir2.md)
-
-
-Do (in_dir2 -> in_dir2_new):
- :edit $HOME/testmarkdown/dir2/in_dir2.md\<CR>
-
- :Log 'Append filename'\<CR>
- :call append('$', [expand('%')])\<CR>
-
- :Log 'Rename'\<CR>
- :call WriteMe()\<CR>
- :VimwikiRenameFile\<CR>
- y\<CR>
- in_dir2_new\<CR>
- :call WriteMe()\<Cr>
-
- :Log 'Append filename'\<CR>
- :call append('$', [expand('%')])\<CR>
-
-
-Expect (old and new filenames):
-
- /home/vimtest/testmarkdown/dir2/in_dir2.md
- /home/vimtest/testmarkdown/dir2/in_dir2_new.md
-
-Execute (edit Test-Rename.md):
- edit $HOME/testmarkdown/Test-Rename.md
-
-
-Expect (Link to in_dir11_new):
- # Test Rename
- [in_root](in_root.md)
- [dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
- [dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
- [dir2 in_dir2](dir2/in_dir2_new.md)
-
-
-Execute (edit in_dir11.md):
- edit $HOME/testmarkdown/dir1/dir11/in_dir11_new.md
-
-
-Expect (Link to in_dir2_new):
- # Title in_dir11
- [dir2 link](../../dir2/in_dir2_new.md)
-
- /home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
-
-
-Execute (Clean dir1 and dir2):
- Log "End: Clean"
- call DeleteHiddenBuffers()
- call system('rm $HOME/testmarkdown/Test-Rename.md')
- call system('rm $HOME/testmarkdown/in_root.md')
- call system('rm -r $HOME/testmarkdown/dir1')
- call system('rm -r $HOME/testmarkdown/dir2')
-
-
-# vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
diff --git a/test/commentstring.vader b/test/config_commentstring.vader
diff --git a/test/convert_default_html.vader b/test/convert_default_html.vader
@@ -1,289 +0,0 @@
-# Conertion: Wiki -> Html
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-#################################################
-Given vimwiki (Comments):
- This is some text
- %% This is a comment
- Test%%+INLINE COMMENT+%%1
- %%+INLINE COMMENT+%%Test2
- Test3%%+INLINE COMMENT+%%
- %%+ Multiline
- comment
- that
- is
- removed
- +%%
- Final text
-
-Do (Convert):
- :call ConvertWiki2Html()\<Cr>
-# Keep only body
- ggd/<body>\<Cr>
-
-Expect (Comments Removed):
- <body>
-
- <p>
- This is some text
- Test1
- Test2
- Test3
- </p>
-
-
-
-
-
-
- <p>
- Final text
- </p>
-
- </body>
- </html>
-
-
-Execute(Delete):
- call DeleteFile('$HOME/testwiki/test_html_table.wiki')
- call DeleteFile('$HOME/html/default/test_html_table.html')
-
-#################################################
-Given vimwiki (Table no heading {{{1):
- | header1 | header2 |
- | val1 | val2 |
- | val1 | val2 |
- | val1 | val2 |
-
-Do (Convert):
- :call ConvertWiki2Html()\<Cr>
-# Keep only body
- ggd/<body>\<Cr>
-
-
-Expect (Table no heading):
- <body>
-
- <table>
- <tr>
- <td>
- header1
- </td>
- <td>
- header2
- </td>
- </tr>
- <tr>
- <td>
- val1
- </td>
- <td>
- val2
- </td>
- </tr>
- <tr>
- <td>
- val1
- </td>
- <td>
- val2
- </td>
- </tr>
- <tr>
- <td>
- val1
- </td>
- <td>
- val2
- </td>
- </tr>
- </table>
-
- </body>
- </html>
-
-Execute(Delete):
- call DeleteFile('$HOME/testwiki/test_html_table.wiki')
- call DeleteFile('$HOME/html/default/test_html_table.html')
-
-
-Given vimwiki (Table with heading {{{1):
- | header1 | header2 | header3 |
- |---------|---------|---------|
- | val1 | val2 | var3 |
- | val4 | val5 | var6 |
-
-Do (Convert):
- :call ConvertWiki2Html()\<Cr>
-# Keep only body
- ggd/<body>\<Cr>
-
-
-Expect (Table with heading):
- <body>
-
- <table>
- <thead>
- <tr>
- <th>
- header1
- </th>
- <th>
- header2
- </th>
- <th>
- header3
- </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- val1
- </td>
- <td>
- val2
- </td>
- <td>
- var3
- </td>
- </tr>
- <tr>
- <td>
- val4
- </td>
- <td>
- val5
- </td>
- <td>
- var6
- </td>
- </tr>
- </tbody>
- </table>
-
- </body>
- </html>
-
-
-Execute(Delete):
- call DeleteFile('$HOME/testwiki/test_html_table.wiki')
- call DeleteFile('$HOME/html/default/test_html_table.html')
-
-#################################################
-Execute (Log):
- Log '#473: Syntax "local:" doesnt work as expected. #473'
-
-Given vimwiki (Void Md):
-
-Execute (Edit Test473 Wiki):
- edit $HOME/testwiki/TestHtml.wiki
-
-Do (Add local link: [[local:$HOME/here|Link]]):
- :edit $HOME/testwiki/Test473.wiki\<CR>
- i
- [[local:
- \<C-r>=$HOME\<Cr>
- /here|Link]]
- \<Esc>
- :call WriteMe()\<Cr>
- :Vimwiki2HTML\<Cr>
-
-
-Execute (Save and Convert to html):
- edit $HOME/testwiki/Test473.wiki
- Vimwiki2HTML
- AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
-
-
-Given (Void Html):
-
-# TODO mutualise
-Do (Get Html body):
- :read $HOME/html/default/Test473.html\<CR>
-# Goto body
- gg/<body>\<CR>
-# Copy in b
- "bdat
-# Delete All
- ggdG
-# Paste body
- "bP
-# Remove last line
- Gdd
-# Save (Not necessary)
- :write
-
-Expect (Local link):
- <body>
-
- <p>
- <a href="../../here">Link</a>
- </p>
-
- </body>
-
-
-Execute (Delete):
- call DeleteFile(' $HOME/testwiki/Test473.wiki')
-
-#################################################
-Given (Void):
-
-Execute (Edit TestHtml Wiki):
- edit $HOME/testwiki/TestHtml.wiki
- AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
- AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
- AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
-
-Do (Markdwon with %plainhtml):
- :edit $HOME/testwiki/TestHtml.wiki\<CR>
- i%plainhtml<div id="test">\<CR>
- my paragraph\<CR>
- %plainhtml</div>\<CR>\<Esc>
- :set bt=\<CR>
- :write\<CR>
-
-Execute (Save and Convert to html):
- edit $HOME/testwiki/TestHtml.wiki
- Vimwiki2HTML
-
-Given (Void):
-
-Do (Get Html body):
- :read $HOME/html/default/TestHtml.html\<CR>
-# Goto body
- gg/<body>\<CR>
-# Copy in b
- "bdat
-# Delete All
- ggdG
-# Paste body
- "bP
-# Remove last line
- Gdd
-# Save (Not necessary)
- :write
-
-
-
-Expect (Plain Html):
-# the whole default html file should be here as a base + the modifications
-# from "Given"
- <body>
-
- <div id="test">
- <p>
- my paragraph
- </p>
- </div>
-
- </body>
-
-Execute (Delete):
- call DeleteFile('$HOME/testwiki/TestHtml.wiki')
-
-# vim: sw=2 foldmethod=marker foldlevel=30
diff --git a/test/diary_rss_feed.vader b/test/diary_rss_feed.vader
@@ -1,108 +0,0 @@
-# Feature to generate a diray RSS feed (PR #934)
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-Given (Void):
-
-Execute (Generate HTML and RSS feed):
- edit $HOME/testwiki/index.wiki
- Vimwiki2HTML
- VimwikiRss
-
-Given (Void):
-
-Do (Get HTML file):
- :read $HOME/html/default/index.html\<CR>
-# Go to line with RSS link
- gg/RSS\<CR>
-# Delete everything above
- kdgg
-# Delete everything below
- jdG
-# Save (Not necessary)
- :write
-
-Expect (RSS link in HTML):
- <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-
-Do (Get RSS feed):
- :read $HOME/html/default/rss.xml\<CR>
-# Remove first line
- ggdd
-# Replace pubDate with dummy as it's based on file modification time
- :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
-# Save (Not necessary)
- :write
-
-Expect (RSS):
- <?xml version="1.0" encoding="UTF-8" ?>
- <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
- <channel>
- <title>Diary</title>
- <link>https://example.com/diary/diary.html</link>
- <description>Diary</description>
- <pubDate>...</pubDate>
- <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
- <item>
- <title>day 4</title>
- <link>https://example.com/diary/2020-07-25.html</link>
- <guid isPermaLink="false">2020-07-25</guid>
- <description><![CDATA[
- <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
-
- <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
-
- <p>
- here is some code:
- </p>
-
- <pre>
- #!/bin/sh
- echo "hello world"
- </pre>
-
- <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
-
- <p>
- an important list:
- </p>
-
- <ul>
- <li>
- point 1
-
- <li>
- point 2
-
- </ul>
- ]]></description>
- <pubDate>...</pubDate>
- </item>
- <item>
- <title>Day 2</title>
- <link>https://example.com/diary/2020-07-23.html</link>
- <guid isPermaLink="false">2020-07-23</guid>
- <description><![CDATA[
- <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
-
- <p>
- another diary entry
- </p>
- ]]></description>
- <pubDate>...</pubDate>
- </item>
- <item>
- <title>2020-07-22</title>
- <link>https://example.com/diary/2020-07-22.html</link>
- <guid isPermaLink="false">2020-07-22</guid>
- <description><![CDATA[
- <p>
- example diary entry for day 1.
- </p>
- ]]></description>
- <pubDate>...</pubDate>
- </item>
- </channel>
- </rss>
diff --git a/test/file_goto.vader b/test/file_goto.vader
@@ -0,0 +1,84 @@
+# VimwikiGoto
+#
+# Note: I dont know why <Tab> is inserting a Tab.
+# Well better than to insert a Chair, but it should trigger completion
+# So I used C-L
+
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+
+
+Execute (VimwikiGoto buzz_bozz && Assert):
+ VimwikiIndex 2
+ VimwikiGoto buzz_bozz
+ AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
+
+Do (VimwikiGoto <CR> buzz_bozz && Assert):
+ :VimwikiIndex 2\<CR>
+ :VimwikiGoto\<CR>
+ buzz_bozz\<CR>
+ :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
+
+Do (VimwikiGoto + Completion(cmdline) && Assert):
+ :VimwikiIndex 2\<CR>
+ :VimwikiGoto buzz_bo\<C-l>\<CR>
+ :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
+
+Do (VimwikiGoto <CR> buzz_bo + Completion(input()) && Assert):
+ :VimwikiIndex 2\<CR>
+ :VimwikiGoto\<CR>
+ buzz_bo\<C-l>\<CR>
+ :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
+
+Do (,wn buzz_bo + Completion(input()) && Assert):
+ ,wn
+ buzz_bo\<C-l>\<CR>
+ :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>
+
+Execute (:VimwikiGoto + Completion (API)):
+ VimwikiIndex 2
+ AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+ let s_complete=string(vimwiki#base#get_globlinks_escaped())
+ Assert -1 != stridx(s_complete, 'buzz_bozz')
+
+Execute (Create dir1/dir2/test_goto_file.md):
+ call system("mkdir $HOME/testmarkdown/dir1")
+ call system("mkdir $HOME/testmarkdown/dir1/dir2")
+ edit $HOME/testmarkdown/dir1/dir2/test_goto_file.md
+ call WriteMe()
+
+Execute (:VimwikiGoto + Completion in directory):
+ " Return to base
+ VimwikiIndex 2
+ AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+
+ " Complete without argment
+ let s_complete1=string(vimwiki#base#get_globlinks_escaped())
+ Assert -1 != stridx(s_complete1, 'test_goto_file')
+
+ " Complete with file argument
+ let s_complete2=string(vimwiki#base#get_globlinks_escaped('test_goto_file'))
+ Assert -1 != stridx(s_complete2, 'test_goto_file')
+
+ " Complete with start of file argument
+ let s_complete3=string(vimwiki#base#get_globlinks_escaped('test_got'))
+ Assert -1 != stridx(s_complete3, 'test_goto_file')
+
+ " Complete with (nested) dir2 argument
+ let s_complete4=string(vimwiki#base#get_globlinks_escaped('dir2'))
+ Assert -1 != stridx(s_complete4, 'test_goto_file')
+
+ " Complete with bad argument
+ let l_complete5=vimwiki#base#get_globlinks_escaped('this_string_is_nowhere')
+ let s_complete5=string(l_complete5)
+ Assert -1 == stridx(s_complete5, 'test_goto_file')
+ AssertEqual 0, len(l_complete5)
+
+Execute (Clean):
+ call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
+ call DeleteFile("$HOME/testmarkdown/index.md")
+ call system("rm $HOME/testmarkdown/dir1")
+
+# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=
diff --git a/test/file_system.vader b/test/file_system.vader
@@ -0,0 +1,35 @@
+# Travel thought files
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+
+
+Given (Void for Accessing other files within vimwiki #979 {{{1):
+
+
+Do (At Index: Create and goto pythonfile):
+ :VimwikiIndex 2\<Cr>
+ Opyfile.py\<Esc>\<Cr>\<Cr>
+ :AssertEqual 'pyfile.py', expand('%:t')\<CR>
+ :AssertEqual 'python', &ft\<CR>
+ :Log "Clean pyfile"\<Cr>
+ dd
+ :VimwikiIndex 2\<Cr>
+ :call DeleteFile('pyfile.py')\<Cr>
+
+
+Do (At Index: Create and goto markdownfile):
+ :VimwikiIndex 2\<Cr>
+ Omdfile.md\<Esc>\<Cr>\<Cr>
+ :AssertEqual 'mdfile.md', expand('%:t')\<CR>
+ :AssertEqual 'vimwiki', &ft\<CR>
+ :Log "Clean mdfile"\<Cr>
+ :VimwikiIndex 2\<Cr>
+ dd
+ :call DeleteFile('mdfile.md')\<Cr>
+
+Execute (Clean):
+ call DeleteFile("$HOME/testmarkdown/index.md")
+
+# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
diff --git a/test/filesystem.vader b/test/filesystem.vader
@@ -1,33 +0,0 @@
-# Travel thought files
-
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-
-Given (Void for Accessing other files within vimwiki #979 {{{1):
-
-
-Do (At Index: Create and goto pythonfile):
- :VimwikiIndex 2\<Cr>
- Opyfile.py\<Esc>\<Cr>\<Cr>
- :AssertEqual 'pyfile.py', expand('%:t')\<CR>
- :AssertEqual 'python', &ft\<CR>
- :Log "Clean pyfile"\<Cr>
- dd
- :VimwikiIndex 2\<Cr>
- :call DeleteFile('pyfile.py')\<Cr>
-
-
-Do (At Index: Create and goto markdownfile):
- :VimwikiIndex 2\<Cr>
- Omdfile.md\<Esc>\<Cr>\<Cr>
- :AssertEqual 'mdfile.md', expand('%:t')\<CR>
- :AssertEqual 'vimwiki', &ft\<CR>
- :Log "Clean mdfile"\<Cr>
- :VimwikiIndex 2\<Cr>
- dd
- :call DeleteFile('mdfile.md')\<Cr>
-
-
-# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
diff --git a/test/html_convert_default.vader b/test/html_convert_default.vader
@@ -0,0 +1,290 @@
+# Conertion: Wiki -> Html
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+
+#################################################
+Given vimwiki (Comments):
+ This is some text
+ %% This is a comment
+ Test%%+INLINE COMMENT+%%1
+ %%+INLINE COMMENT+%%Test2
+ Test3%%+INLINE COMMENT+%%
+ %%+ Multiline
+ comment
+ that
+ is
+ removed
+ +%%
+ Final text
+
+Do (Convert):
+ :call ConvertWiki2Html()\<Cr>
+# Keep only body
+ ggd/<body>\<Cr>
+
+Expect (Comments Removed):
+ <body>
+
+ <p>
+ This is some text
+ Test1
+ Test2
+ Test3
+ </p>
+
+
+
+
+
+
+ <p>
+ Final text
+ </p>
+
+ </body>
+ </html>
+
+
+Execute(Delete):
+ call DeleteFile('$HOME/testwiki/test_html_table.wiki')
+ call DeleteFile('$HOME/html/default/test_html_table.html')
+
+#################################################
+Given vimwiki (Table no heading {{{1):
+ | header1 | header2 |
+ | val1 | val2 |
+ | val1 | val2 |
+ | val1 | val2 |
+
+Do (Convert):
+ :call ConvertWiki2Html()\<Cr>
+# Keep only body
+ ggd/<body>\<Cr>
+
+
+Expect (Table no heading):
+ <body>
+
+ <table>
+ <tr>
+ <td>
+ header1
+ </td>
+ <td>
+ header2
+ </td>
+ </tr>
+ <tr>
+ <td>
+ val1
+ </td>
+ <td>
+ val2
+ </td>
+ </tr>
+ <tr>
+ <td>
+ val1
+ </td>
+ <td>
+ val2
+ </td>
+ </tr>
+ <tr>
+ <td>
+ val1
+ </td>
+ <td>
+ val2
+ </td>
+ </tr>
+ </table>
+
+ </body>
+ </html>
+
+Execute(Delete):
+ call DeleteFile('$HOME/testwiki/test_html_table.wiki')
+ call DeleteFile('$HOME/html/default/test_html_table.html')
+
+
+Given vimwiki (Table with heading {{{1):
+ | header1 | header2 | header3 |
+ |---------|---------|---------|
+ | val1 | val2 | var3 |
+ | val4 | val5 | var6 |
+
+Do (Convert):
+ :call ConvertWiki2Html()\<Cr>
+# Keep only body
+ ggd/<body>\<Cr>
+
+
+Expect (Table with heading):
+ <body>
+
+ <table>
+ <thead>
+ <tr>
+ <th>
+ header1
+ </th>
+ <th>
+ header2
+ </th>
+ <th>
+ header3
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ val1
+ </td>
+ <td>
+ val2
+ </td>
+ <td>
+ var3
+ </td>
+ </tr>
+ <tr>
+ <td>
+ val4
+ </td>
+ <td>
+ val5
+ </td>
+ <td>
+ var6
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </body>
+ </html>
+
+
+Execute(Delete):
+ call DeleteFile('$HOME/testwiki/test_html_table.wiki')
+ call DeleteFile('$HOME/html/default/test_html_table.html')
+
+#################################################
+Execute (Log):
+ Log '#473: Syntax "local:" doesnt work as expected. #473'
+
+Given vimwiki (Void Md):
+
+Execute (Edit Test473 Wiki):
+ edit $HOME/testwiki/TestHtml.wiki
+
+Do (Add local link: [[local:$HOME/here|Link]]):
+ :edit $HOME/testwiki/Test473.wiki\<CR>
+ i
+ [[local:
+ \<C-r>=$HOME\<Cr>
+ /here|Link]]
+ \<Esc>
+ :call WriteMe()\<Cr>
+ :Vimwiki2HTML\<Cr>
+
+
+Execute (Save and Convert to html):
+ edit $HOME/testwiki/Test473.wiki
+ Vimwiki2HTML
+ AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
+
+
+Given (Void Html):
+
+# TODO mutualise
+Do (Get Html body):
+ :read $HOME/html/default/Test473.html\<CR>
+# Goto body
+ gg/<body>\<CR>
+# Copy in b
+ "bdat
+# Delete All
+ ggdG
+# Paste body
+ "bP
+# Remove last line
+ Gdd
+# Save (Not necessary)
+ :write
+
+Expect (Local link):
+ <body>
+
+ <p>
+ <a href="../../here">Link</a>
+ </p>
+
+ </body>
+
+
+Execute (Delete):
+ call DeleteFile(' $HOME/testwiki/Test473.wiki')
+
+#################################################
+Given (Void):
+
+Execute (Edit TestHtml Wiki):
+ edit $HOME/testwiki/TestHtml.wiki
+ AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
+ AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
+ AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
+
+Do (Markdwon with %plainhtml):
+ :edit $HOME/testwiki/TestHtml.wiki\<CR>
+ :normal ggdG\<Cr>
+ i%plainhtml<div id="test">\<CR>
+ my paragraph\<CR>
+ %plainhtml</div>\<CR>\<Esc>
+ :set bt=\<CR>
+ :write\<CR>
+
+Execute (Save and Convert to html):
+ edit $HOME/testwiki/TestHtml.wiki
+ Vimwiki2HTML
+
+Given (Void):
+
+Do (Get Html body):
+ :read $HOME/html/default/TestHtml.html\<CR>
+# Goto body
+ gg/<body>\<CR>
+# Copy in b
+ "bdat
+# Delete All
+ ggdG
+# Paste body
+ "bP
+# Remove last line
+ Gdd
+# Save (Not necessary)
+ :write
+
+
+
+Expect (Plain Html):
+# the whole default html file should be here as a base + the modifications
+# from "Given"
+ <body>
+
+ <div id="test">
+ <p>
+ my paragraph
+ </p>
+ </div>
+
+ </body>
+
+Execute (Delete):
+ call DeleteFile('$HOME/testwiki/TestHtml.wiki')
+
+# vim: sw=2 foldmethod=marker foldlevel=30
diff --git a/test/html_diary_rss_feed.vader b/test/html_diary_rss_feed.vader
@@ -0,0 +1,109 @@
+# Feature to generate a diray RSS feed (PR #934)
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+
+Given (Void):
+
+Execute (Generate HTML and RSS feed):
+ edit $HOME/testwiki/index.wiki
+ Vimwiki2HTML
+ VimwikiRss
+
+Given (Void):
+
+Do (Get HTML file):
+ :read $HOME/html/default/index.html\<CR>
+# Go to line with RSS link
+ gg/RSS\<CR>
+# Delete everything above
+ kdgg
+# Delete everything below
+ jdG
+# Save (Not necessary)
+ :write
+
+Expect (RSS link in HTML):
+ <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
+
+Do (Get RSS feed):
+ :read $HOME/html/default/rss.xml\<CR>
+# Remove first line
+ ggdd
+# Replace pubDate with dummy as it's based on file modification time
+ :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
+# Save (Not necessary)
+ :write
+
+Expect (RSS):
+# TODO the next line is deleted with -Es
+# <?xml version="1.0" encoding="UTF-8" ?>
+ <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <title>Diary</title>
+ <link>https://example.com/diary/diary.html</link>
+ <description>Diary</description>
+ <pubDate>...</pubDate>
+ <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
+ <item>
+ <title>day 4</title>
+ <link>https://example.com/diary/2020-07-25.html</link>
+ <guid isPermaLink="false">2020-07-25</guid>
+ <description><![CDATA[
+ <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
+
+ <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
+
+ <p>
+ here is some code:
+ </p>
+
+ <pre>
+ #!/bin/sh
+ echo "hello world"
+ </pre>
+
+ <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
+
+ <p>
+ an important list:
+ </p>
+
+ <ul>
+ <li>
+ point 1
+
+ <li>
+ point 2
+
+ </ul>
+ ]]></description>
+ <pubDate>...</pubDate>
+ </item>
+ <item>
+ <title>Day 2</title>
+ <link>https://example.com/diary/2020-07-23.html</link>
+ <guid isPermaLink="false">2020-07-23</guid>
+ <description><![CDATA[
+ <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
+
+ <p>
+ another diary entry
+ </p>
+ ]]></description>
+ <pubDate>...</pubDate>
+ </item>
+ <item>
+ <title>2020-07-22</title>
+ <link>https://example.com/diary/2020-07-22.html</link>
+ <guid isPermaLink="false">2020-07-22</guid>
+ <description><![CDATA[
+ <p>
+ example diary entry for day 1.
+ </p>
+ ]]></description>
+ <pubDate>...</pubDate>
+ </item>
+ </channel>
+ </rss>
diff --git a/test/independent_runs/map.vader b/test/independent_runs/map.vader
@@ -1,3 +1,8 @@
+# Maps
+# TODO make it without side effects
+# -- Use the normal vimwiki or reset it
+
+
# 0 Configure {{{1
##################
@@ -26,7 +31,23 @@ Execute (Configure: Set vimwiki list to markdown resource):
let g:vimwiki_ext2syntax = {'.md': 'markdown'}
Log "Reload vimwiki <- vader_setup.vader"
- call ReloadVimwiki()
+ nmapclear
+
+ " UNlet what can be
+ for i in ['g:vimwiki_commentstring',
+ \ 'b:did_ftplugin',
+ \ 'g:loaded_vimwiki',
+ \ 'g:vimwiki_global_vars',
+ \ 'g:vimwiki_wikilocal_vars',
+ \ 'g:vimwiki_syntax_variables',
+ \ ]
+ if exists(i)
+ exe 'unlet ' . i
+ endif
+ endfor
+
+ " Source plugin: Go
+ runtime! plugin/vimwiki.vim
Execute (Assert: 2 wiki in Index):
AssertEqual 2, len(vimwiki_wikilocal_vars)
@@ -304,7 +325,15 @@ Given vimwiki (Completion list #813 {{{3):
Do (Insert a list item and complete):
Go
- * comp\<C-n>\<Down>\<Cr>
+ * comp\<C-n>\<C-n>\<Cr>\<Esc>
+# -Es -> Delete trailing *
+ :let mode = mode(1)\<Cr>
+ :Log 'Mode : ' .mode\<Cr>
+ :if mode ==# 'ce' || mode ==# 'cv'\<Cr>
+ try\<Cr>
+ g/^\* \?$/d\<Cr>
+ endtry\<Cr>
+ endif\<Cr>
Expect (With a completion but no new item):
complete1
diff --git a/test/independent_runs/search.vader b/test/independent_runs/search.vader
@@ -59,4 +59,4 @@ Execute (Search failure message):
redir => output
silent VimwikiSearch not_exist
redir END
- Assert match(output, 'VimwikiSearch: No match found.') > -1, "expected custom error"
+ Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
diff --git a/test/issue_markdown.vader b/test/issue_markdown.vader
@@ -4,11 +4,18 @@
# Thanks to all contributors with issues and pull request on github
#
+Given vimwiki (a):
+ a
+
+Execute (Set filename wiki_test.md):
+ file wiki_test.md
+
+Expect (a):
+ a
################################################################################
Execute (Log):
Log '#915 Vimwiki Markdown Blockquote Syntax issue'
- file wiki_test.md
call SetSyntax('markdown')
Given vimwiki (One blockquote):
@@ -46,7 +53,6 @@ Execute (no JJ && Assert for Version > 7.3):
################################################################################
Execute (Log):
Log '#949 <Enter> create link bug with Chinese characters'
- file wiki_test.md
call SetSyntax('markdown')
Given vimwiki (Madarin with vimwiki Yeeepy):
@@ -101,7 +107,6 @@ Expect (Renumber all):
################################################################################
Execute (Log):
Log '#899 conceallevel is setted globally when editing a wiki file (PR #900)'
- file wiki_test.md
call SetSyntax('markdown')
Given vimwiki (Void):
@@ -163,3 +168,10 @@ Do (No link: <CR><CR>):
:call vimwiki#vars#set_global('markdown_create_link', 0)
\<CR>\<CR>
:AssertEqual expand('%:t'), 'main.md'\<CR>
+
+Expect (Link):
+ [Link](Link)
+
+Execute (wipeout):
+ " This solves many things
+ file /testplugin/[Vader-workbench]
diff --git a/test/issue_profile_tabnext.vader b/test/issue_profile_tabnext.vader
@@ -0,0 +1,51 @@
+# See Issue #580
+
+Given vimwiki (Void):
+ Tabnext
+
+Execute (Set fold method):
+ let g:vimwiki_folding = 'expr:quick'
+ call ReloadVimwiki()
+
+Execute (Expect < 0.5 second delay: Issue #580):
+ let mode = mode(1)
+ Log 'Mode : ' .mode
+ if mode ==# 'ce' || mode ==# 'cv' " -es (silent ex mode)
+ Log 'Skiped: Tabedit and tabnext are not working weel with -Es'
+ else
+ Log 'Prepare: Edit: mode: ' . mode
+ edit /testplugin/test/resources/delay.wiki
+ Log 'Prepare: Assert'
+ AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
+ Log 'Prepare: Goto 50%'
+ normal! 50%
+# "TODO set ft and set wiki syntax or this error (no fold found)
+# "normal! zozo
+
+ Log 'Run: tabedit'
+ let start = reltime()
+ tabedit
+ let end = str2float(reltimestr(reltime(start)))
+
+ Log 'Verify redraw'
+ Log 'Elapsed time Tabedit = ' . string(end)
+ Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
+
+ Log 'Run: redraw'
+ let start = reltime()
+ tabprev
+ redraw
+ let end = str2float(reltimestr(reltime(start)))
+
+ Log 'Verify redraw'
+ Log 'Elapsed time redraw = ' . string(end)
+ Assert end < 0.5, 'Redraw Took longer than expected: ' . string(end) . ' seconds'
+ endif
+
+Execute (Reset variables):
+ call DeleteFile('/testplugin/test/resources/delay.wiki')
+ let g:vimwiki_folding = ''
+ call ReloadVimwiki()
+
+Expect vimwiki (Tabnext):
+ Tabnext
diff --git a/test/link_anchor.vader b/test/link_anchor.vader
@@ -0,0 +1,388 @@
+# Link internal to a file
+#
+# See: generate_toc.vim
+#
+# See issue #666 for anchor support (then internal links)
+# Preambule set file onces and for all {{{1
+# Otherwise the bash script is freezing
+
+
+
+
+Given vimwiki (a):
+ a
+
+Execute (Set filename wiki_test.md):
+ file wiki_test.md
+
+Expect (a):
+ a
+
+
+Given vimwiki (VimwikiTOC with link and number {{{1):
+ [link1](#i-v-p-741528)
+ [link2](#i-v-p-741528-2)
+
+ # I [V p](h) (7.415.28)
+
+ # I [V p](h) 741.528
+
+Execute (Set syntax markdown):
+ call SetSyntax('markdown')
+
+Do (Enter link):
+ gg\<Cr>
+ A__HERE1__\<Esc>
+ ggj\<Cr>
+ A__HERE2__\<Esc>
+
+Expect():
+ [link1](#i-v-p-741528)
+ [link2](#i-v-p-741528-2)
+
+ # I [V p](h) (7.415.28)__HERE1__
+
+ # I [V p](h) 741.528__HERE2__
+
+Given vimwiki (VimwikiTOC is broken against headers with link #182 {{{1):
+ [A link B](#a-link-b)
+ [tlink](#tlink)
+ [7.4.1528](#741528)
+ [link (333)](#link-333)
+
+ # A [link](anything here) B
+
+ # t[link](anything here)
+
+ ## 7.4.1528
+
+ #### [link]() (333)
+
+
+Execute (Set syntax markdown):
+ call SetSyntax('markdown')
+
+
+Do (Enter link):
+ gg\<Cr>
+ A__HERE1__\<Esc>
+ ggj\<Cr>
+ A__HERE2__\<Esc>
+ ggjj\<Cr>
+ A__HERE3__\<Esc>
+ ggjjj\<Cr>
+ A__HERE4__\<Esc>
+ :AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')\<Cr>
+
+
+Expect vimwiki (Good anchor with link navigation):
+ [A link B](#a-link-b)
+ [tlink](#tlink)
+ [7.4.1528](#741528)
+ [link (333)](#link-333)
+
+ # A [link](anything here) B__HERE1__
+
+ # t[link](anything here)__HERE2__
+
+ ## 7.4.1528__HERE3__
+
+ #### [link]() (333)__HERE4__
+
+
+
+# Link to anchor in SetExt {{{1
+# Like that
+# -----
+# Issue: #209
+
+Given vimwiki (Anchor SetExt):
+ [jump](#frst-one)
+
+ F!rst One
+ =========
+
+Execute (Set filename wiki_test.md):
+ call SetSyntax('markdown')
+
+Do (Enter link):
+ \<Cr>
+ A__HERE__\<Esc>
+
+Expect (Cursor jumped SetExt):
+ [jump](#frst-one)
+
+ F!rst One__HERE__
+ =========
+
+Given vimwiki (Bad Anchor SetExt):
+ [jump](#frst-one)
+
+ F!rst One
+
+Execute (Set filename wiki_test.md):
+ call SetSyntax('markdown')
+
+Do (Enter link):
+ \<Cr>
+ A__HERE__\<Esc>
+
+Expect (Cursor stayed (not jumped) SetExt):
+ [jump](#frst-one)__HERE__
+
+ F!rst One
+
+# Link to anchor with spaces {{{1
+# PR #840
+# Issues: #831
+
+Given vimwiki (Internal links zith spaces):
+ [Any ! apparent name @#$](#basic-heading-many-spaces)
+ One line here
+
+ ## Basic HeAding Many SpacES
+
+ One line here
+
+Execute (Set filename wiki_test.md):
+ call SetSyntax('markdown')
+
+Do (Enter link):
+ \<Cr>
+ A__HERE__\<Esc>
+
+Expect (Cursor at heading position):
+ [Any ! apparent name @#$](#basic-heading-many-spaces)
+ One line here
+
+ ## Basic HeAding Many SpacES__HERE__
+
+ One line here
+
+Execute (Clear wiki jumps (alias: prev_links)):
+ call vimwiki#vars#set_bufferlocal('prev_links', [])
+
+
+# Before {{{1
+
+Given vimwiki (Internal links + one link to filenew):
+ # Contents
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+
+ # Test1
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew)
+
+ # Test2
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew)
+
+Execute (Set filename wiki_test.md):
+ call SetSyntax('markdown')
+
+Do (Navigate with <Tab>):
+ A more Contents\<Esc>
+ \<Tab>
+ \<Enter>
+ A more Test1\<Esc>
+ \<Tab>
+ \<Tab>
+ \<Enter>
+ A more Test2\<Esc>
+
+Expect (Content added to titles):
+ # Contents more Contents
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+
+ # Test1 more Test1
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew)
+
+ # Test2 more Test2
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew)
+
+Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
+ \<Tab>
+ \<Enter>
+# Cursor at Test1
+ \<Tab>
+ \<Tab>
+ \<Enter>
+# Cursor at Test2
+ \<Tab>
+ \<Tab>
+ \<Tab>
+# Cursor at Test2/filenew
+ A not yet\<Esc>
+ \<Bs>
+# Cursor at Test1/test2
+ A near Test1/test2
+ \<Esc>
+ \<Bs>
+# Cursor at Contents/test1
+ A near Contents/test1
+ \<Esc>
+
+Expect (Vimwiki links):
+ # Contents
+
+ - [Test1](#Test1) near Contents/test1
+ - [Test2](#Test2)
+
+ # Test1
+
+ - [Test1](#Test1)
+ - [Test2](#Test2) near Test1/test2
+ - [filenew](filenew)
+
+ # Test2
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew) not yet
+
+Do (Navigate with <Tab> comeback with <Bs> from filenew):
+ \<Tab>
+ A first shot\<Esc>
+ 0\<Tab>
+# Cursor at Contents/test1
+ \<Enter>
+ \<Tab>
+ \<Tab>
+ A first shot\<Esc>
+ 0\<Tab>
+# Cursor at Test1/test2
+ \<Enter>
+ G
+# Cursor at Test2/filenew
+ A first shot\<Esc>
+ 0\<Tab>
+# Cursor at Test2/filenew
+ \<Enter>
+# Cursor in filenew (a new file)
+ A anything in filenew: empirically it does not count\<Esc>
+ \<Bs>
+# Cursor at Test2/filenew
+ \<Bs>
+# Cursor at Test1/test2
+ \<Bs>
+# Cursor at Contents/test1
+ A second shot
+
+Expect (Just Contents/test1 got the second shot):
+ # Contents
+
+ - [Test1](#Test1) first shot second shot
+ - [Test2](#Test2)
+
+ # Test1
+
+ - [Test1](#Test1)
+ - [Test2](#Test2) first shot
+ - [filenew](filenew)
+
+ # Test2
+
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+ - [filenew](filenew) first shot
+
+Execute (Delete filenew buffer):
+ call DeleteFile('/testplugin/filenew.md')
+
+Do (Navigate with <Tab> comeback with <Bs> too far):
+ \<Tab>
+# Cursor at Contents/test1
+ \<Enter>
+ \<Tab>
+ \<Tab>
+# Cursor at Test1/test2
+ \<Enter>
+ \<Tab>
+# Cursor at Test2/test1
+ \<Enter>
+ \<Tab>
+ \<Tab>
+# Cursor at Test1/test2
+ \<Enter>
+ A first test2\<Esc>
+ \<Tab>
+# Cursor at Test2/test1
+ \<Enter>
+ A first test1\<Esc>
+# Back
+ \<Bs>
+# Cursor at Test2/test1
+ A second test2/test1\<Esc>
+ \<Bs>
+# Cursor at Test1/test2
+ A second test1/test2\<Esc>
+ \<Bs>
+# Cursor at Test2/test1
+ \<Bs>
+# Cursor at Test1/test2
+ \<Bs>
+# Cursor at Contents/test1
+# Finished
+ \<Bs>
+ \<Bs>
+ \<Bs>
+ \<Bs>
+ A 1\<Esc>
+ \<Bs>
+ A 2\<Esc>
+ \<Bs>
+ A 3\<Esc>
+ \<Bs>
+ A 4\<Esc>
+
+Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
+ # Contents
+
+ - [Test1](#Test1) 1 2 3 4
+ - [Test2](#Test2)
+
+ # Test1 first test1
+
+ - [Test1](#Test1)
+ - [Test2](#Test2) second test1/test2
+ - [filenew](filenew)
+
+ # Test2 first test2
+
+ - [Test1](#Test1) second test2/test1
+ - [Test2](#Test2)
+ - [filenew](filenew)
+
+Given vimwiki (link to self):
+ - [Bad link](Very bad.html)
+ - [My own file](wiki_test)
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+
+Do (Follow link to self and append chars):
+ \<Tab>
+ \<Tab>
+ \<Enter>
+ a this_is_18_chars \<Esc>
+
+Expect (Some chars appended at self link):
+ - [Bad link](Very bad.html)
+ - [ this_is_18_chars My own file](wiki_test)
+ - [Test1](#Test1)
+ - [Test2](#Test2)
+
+# vim: foldmethod=marker foldlevel=30 sw=2
diff --git a/test/link_creation.vader b/test/link_creation.vader
@@ -200,6 +200,11 @@ Do (Check in_tmp):
jj\<Cr>
:AssertEqual expand('%'), '/tmp/in_tmp.wiki'\<Cr>
+Execute(Clean: temporary):
+ call ReloadVimwiki()
+ call DeleteFile('$HOME/in_home1.md')
+ call DeleteFile('~/in_home2.md')
+ call DeleteFile('/tmp/in_tmp.md')
# Link with dot {{{1
####################
@@ -368,4 +373,7 @@ Expect (Mediawiki links):
[[file.md]]
[[file.mw]]
+Execute(Clean: Icreated many temporary wiki):
+ call ReloadVimwiki()
+
# vim: foldmethod=marker foldlevel=30
diff --git a/test/link_generation.vader b/test/link_generation.vader
@@ -0,0 +1,206 @@
+# Automatic link generation
+# Related to:
+# - wiki file discovery
+# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
+
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+ set sw=8
+
+# 1 VimwikiGenerateLinks {{{1
+##########################
+# Wiki Syntax {{{2
+#################
+
+Execute (Log):
+ Log 'Wiki Syntax'
+
+Given (Void):
+
+Execute (VimwikiGenerateLinks):
+ edit $HOME/testwiki/Test.wiki
+ VimwikiGenerateLinks
+
+Expect (The links with a header):
+
+
+ = Generated Links =
+ - [[buzz_bozz]]
+ - [[index]]
+
+Execute (VimwikiGenerateLinks x 2):
+ edit $HOME/testwiki/Test.wiki
+ VimwikiGenerateLinks
+ call append('$', 'Last Line')
+ VimwikiGenerateLinks
+
+Expect (The links with a header (bis)):
+
+
+ = Generated Links =
+ - [[buzz_bozz]]
+ - [[index]]
+
+ Last Line
+
+Execute (Clean Test.wiki):
+ call DeleteFile('$HOME/testwiki/Test.wiki')
+
+
+# Markdown Syntax {{{2
+#################
+
+Execute (Log):
+ Log 'Markdown Syntax'
+
+Given (Void):
+
+Execute (Goto markdown resource wiki):
+ VimwikiIndex 2
+ AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+
+Execute (Edit Test file / VimwikiGenerateLinks):
+ edit $HOME/testmarkdown/Test.md
+ AssertEqual $HOME . '/testmarkdown/Test.md', expand('%')
+ AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
+ AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
+ VimwikiGenerateLinks
+
+Expect (The links with a header):
+
+
+ # Generated Links
+
+ - [Buzz Bozz](buzz_bozz)
+ - [Test Wiki](index)
+
+Do (Save Test.md && Re-GenerateLinks):
+ :edit $HOME/testmarkdown/Test.md\<CR>
+ :call WriteMe()\<CR>
+ :VimwikiGenerateLinks\<CR>
+ :VimwikiGenerateLinks\<CR>
+
+Expect (The links with a header with file Test):
+
+
+ # Generated Links
+
+ - [Generated Links](Test)
+ - [Buzz Bozz](buzz_bozz)
+ - [Test Wiki](index)
+
+Execute (Clean: Remove Test.md):
+ call DeleteFile('$HOME/testmarkdown/Test.md')
+
+
+# 2 VimwikiDiaryGenerateLinks {{{1
+#############################
+
+# Wiki Syntax {{{1
+#################
+
+Execute (Log):
+ Log 'Wiki Syntax'
+
+Do (Create diary files):
+ :edit $HOME/testwiki/diary/2019-12-10.wiki\<Cr>
+ :call append('$', 'Content')\<Cr>
+ :call WriteMe()\<Cr>
+ :edit $HOME/testwiki/diary/2019-07-13.wiki\<Cr>
+ :call append('$', 'Content')\<Cr>
+ :call WriteMe()\<Cr>
+ :edit $HOME/testwiki/diary/2019-03-01.wiki\<Cr>
+ :call append('$', 'Content')\<Cr>
+ :call WriteMe()\<Cr>
+
+Do (Edit diary.wiki && GenerateDiaryLinks):
+ :edit $HOME/testwiki/diary/diary.wiki\<CR>
+ :VimwikiDiaryGenerateLinks\<CR>
+
+Expect (diary index generated):
+ = Diary =
+ == 2020 ==
+
+ === July ===
+ - [[2020-07-25|day 4]]
+ - [[2020-07-24|day 3]]
+ - [[2020-07-23|Day 2]]
+ - [[2020-07-22]]
+
+ == 2019 ==
+
+ === December ===
+ - [[2019-12-10]]
+
+ === July ===
+ - [[2019-07-13]]
+
+ === March ===
+ - [[2019-03-01]]
+
+Execute (Clean):
+ Log "End: Clean"
+ call DeleteFile('$HOME/testwiki/diary/2019-12-10.wiki')
+ call DeleteFile('$HOME/testwiki/diary/2019-07-13.wiki')
+ call DeleteFile('$HOME/testwiki/diary/2019-03-01.wiki')
+ Log "End: Reset shiftwidth to the default: 8"
+
+# Wiki Markdown {{{1
+#################
+
+Execute (Log):
+ Log 'Markdown Syntax'
+
+Execute (New Command):
+ Log "2. Testing VimwikiDiaryGenerateLinks TODO"
+ set sw=4
+ AssertEqual 4, &sw
+
+Do (Edit diary/2019-12-10):
+ :edit $HOME/testmarkdown/diary/2019-12-10.md\<CR>
+ iinformative content\<Esc>
+ :call WriteMe()\<CR>
+
+Do (Edit and save diary/2019-07-13):
+ :edit $HOME/testmarkdown/diary/2019-07-13.md\<CR>
+ i# informative title\<Esc>
+ :call WriteMe()\<CR>
+
+Do (Edit and save diary/2018-03-01):
+ :edit $HOME/testmarkdown/diary/2019-03-01.md\<CR>
+ :call WriteMe()\<CR>
+
+
+Do (Edit diary.md && GenerateDiaryLinks):
+ :edit $HOME/testmarkdown/diary/diary.md\<CR>
+ :VimwikiDiaryGenerateLinks\<CR>
+
+Expect (diary index generated):
+ # Diary
+
+ ## 2019
+
+ ### December
+
+ - [2019-12-10](2019-12-10)
+
+ ### July
+
+ - [informative title](2019-07-13)
+
+ ### March
+
+ - [2019-03-01](2019-03-01)
+
+
+Execute (Clean):
+ call DeleteFile("$HOME/testmarkdown/index.md")
+ call DeleteFile('$HOME/testmarkdown/diary/2019-12-10.md')
+ call DeleteFile('$HOME/testmarkdown/diary/2019-07-13.md')
+ call DeleteFile('$HOME/testmarkdown/diary/2019-03-01.md')
+ Log "End: Reset shiftwidth to the default: 8"
+ set sw&
+
+# vim: sw=2:foldmethod=marker:foldlevel=30:foldignore=:
diff --git a/test/link_markdown_multiple_per_file.vader b/test/link_markdown_multiple_per_file.vader
@@ -1,386 +0,0 @@
-# Link internal to a file
-#
-# See: generate_toc.vim
-#
-# See issue #666 for anchor support (then internal links)
-# Preambule set file onces and for all {{{1
-# Otherwise the bash script is freezing
-
-
-
-
-Given vimwiki (a):
- a
-
-Execute (Set filename wiki_test.md):
- file wiki_test.md
-
-Expect (a):
- a
-
-
-Given vimwiki (VimwikiTOC with link and number {{{1):
- [link1](#i-v-p-741528)
- [link2](#i-v-p-741528-2)
-
- # I [V p](h) (7.415.28)
-
- # I [V p](h) 741.528
-
-Execute (Set syntax markdown):
- call SetSyntax('markdown')
-
-Do (Enter link):
- gg\<Cr>
- A__HERE1__\<Esc>
- ggj\<Cr>
- A__HERE2__\<Esc>
-
-Expect():
- [link1](#i-v-p-741528)
- [link2](#i-v-p-741528-2)
-
- # I [V p](h) (7.415.28)__HERE1__
-
- # I [V p](h) 741.528__HERE2__
-
-Given vimwiki (VimwikiTOC is broken against headers with link #182 {{{1):
- [A link B](#a-link-b)
- [tlink](#tlink)
- [7.4.1528](#741528)
- [link (333)](#link-333)
-
- # A [link](anything here) B
-
- # t[link](anything here)
-
- ## 7.4.1528
-
- #### [link]() (333)
-
-
-Execute (Set syntax markdown):
- call SetSyntax('markdown')
-
-
-Do (Enter link):
- gg\<Cr>
- A__HERE1__\<Esc>
- ggj\<Cr>
- A__HERE2__\<Esc>
- ggjj\<Cr>
- A__HERE3__\<Esc>
- ggjjj\<Cr>
- A__HERE4__\<Esc>
-
-Expect vimwiki (Good anchor with link navigation):
- [A link B](#a-link-b)
- [tlink](#tlink)
- [7.4.1528](#741528)
- [link (333)](#link-333)
-
- # A [link](anything here) B__HERE1__
-
- # t[link](anything here)__HERE2__
-
- ## 7.4.1528__HERE3__
-
- #### [link]() (333)__HERE4__
-
-
-
-# Link to anchor in SetExt {{{1
-# Like that
-# -----
-# Issue: #209
-
-Given vimwiki (Anchor SetExt):
- [jump](#frst-one)
-
- F!rst One
- =========
-
-Execute (Set filename wiki_test.md):
- call SetSyntax('markdown')
-
-Do (Enter link):
- \<Cr>
- A__HERE__\<Esc>
-
-Expect (Cursor jumped SetExt):
- [jump](#frst-one)
-
- F!rst One__HERE__
- =========
-
-Given vimwiki (Bad Anchor SetExt):
- [jump](#frst-one)
-
- F!rst One
-
-Execute (Set filename wiki_test.md):
- call SetSyntax('markdown')
-
-Do (Enter link):
- \<Cr>
- A__HERE__\<Esc>
-
-Expect (Cursor stayed (not jumped) SetExt):
- [jump](#frst-one)__HERE__
-
- F!rst One
-
-# Link to anchor with spaces {{{1
-# PR #840
-# Issues: #831
-
-Given vimwiki (Internal links zith spaces):
- [Any ! apparent name @#$](#basic-heading-many-spaces)
- One line here
-
- ## Basic HeAding Many SpacES
-
- One line here
-
-Execute (Set filename wiki_test.md):
- call SetSyntax('markdown')
-
-Do (Enter link):
- \<Cr>
- A__HERE__\<Esc>
-
-Expect (Cursor at heading position):
- [Any ! apparent name @#$](#basic-heading-many-spaces)
- One line here
-
- ## Basic HeAding Many SpacES__HERE__
-
- One line here
-
-Execute (Clear wiki jumps (alias: prev_links)):
- call vimwiki#vars#set_bufferlocal('prev_links', [])
-
-
-# Before {{{1
-
-Given vimwiki (Internal links + one link to filenew):
- # Contents
-
- - [Test1](#Test1)
- - [Test2](#Test2)
-
- # Test1
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew)
-
- # Test2
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew)
-
-Execute (Set filename wiki_test.md):
- call SetSyntax('markdown')
-
-Do (Navigate with <Tab>):
- A more Contents\<Esc>
- \<Tab>
- \<Enter>
- A more Test1\<Esc>
- \<Tab>
- \<Tab>
- \<Enter>
- A more Test2\<Esc>
-
-Expect (Content added to titles):
- # Contents more Contents
-
- - [Test1](#Test1)
- - [Test2](#Test2)
-
- # Test1 more Test1
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew)
-
- # Test2 more Test2
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew)
-
-Do (Navigate with <Tab> and <Enter> and come back with <Bs>):
- \<Tab>
- \<Enter>
-# Cursor at Test1
- \<Tab>
- \<Tab>
- \<Enter>
-# Cursor at Test2
- \<Tab>
- \<Tab>
- \<Tab>
-# Cursor at Test2/filenew
- A not yet\<Esc>
- \<Bs>
-# Cursor at Test1/test2
- A near Test1/test2
- \<Esc>
- \<Bs>
-# Cursor at Contents/test1
- A near Contents/test1
- \<Esc>
-
-Expect (Vimwiki links):
- # Contents
-
- - [Test1](#Test1) near Contents/test1
- - [Test2](#Test2)
-
- # Test1
-
- - [Test1](#Test1)
- - [Test2](#Test2) near Test1/test2
- - [filenew](filenew)
-
- # Test2
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew) not yet
-
-Do (Navigate with <Tab> comeback with <Bs> from filenew):
- \<Tab>
- A first shot\<Esc>
- 0\<Tab>
-# Cursor at Contents/test1
- \<Enter>
- \<Tab>
- \<Tab>
- A first shot\<Esc>
- 0\<Tab>
-# Cursor at Test1/test2
- \<Enter>
- G
-# Cursor at Test2/filenew
- A first shot\<Esc>
- 0\<Tab>
-# Cursor at Test2/filenew
- \<Enter>
-# Cursor in filenew (a new file)
- A anything in filenew: empirically it does not count\<Esc>
- \<Bs>
-# Cursor at Test2/filenew
- \<Bs>
-# Cursor at Test1/test2
- \<Bs>
-# Cursor at Contents/test1
- A second shot
-
-Expect (Just Contents/test1 got the second shot):
- # Contents
-
- - [Test1](#Test1) first shot second shot
- - [Test2](#Test2)
-
- # Test1
-
- - [Test1](#Test1)
- - [Test2](#Test2) first shot
- - [filenew](filenew)
-
- # Test2
-
- - [Test1](#Test1)
- - [Test2](#Test2)
- - [filenew](filenew) first shot
-
-Execute (Delete filenew buffer):
- bd! /testplugin/filenew.md
-
-Do (Navigate with <Tab> comeback with <Bs> too far):
- \<Tab>
-# Cursor at Contents/test1
- \<Enter>
- \<Tab>
- \<Tab>
-# Cursor at Test1/test2
- \<Enter>
- \<Tab>
-# Cursor at Test2/test1
- \<Enter>
- \<Tab>
- \<Tab>
-# Cursor at Test1/test2
- \<Enter>
- A first test2\<Esc>
- \<Tab>
-# Cursor at Test2/test1
- \<Enter>
- A first test1\<Esc>
-# Back
- \<Bs>
-# Cursor at Test2/test1
- A second test2/test1\<Esc>
- \<Bs>
-# Cursor at Test1/test2
- A second test1/test2\<Esc>
- \<Bs>
-# Cursor at Test2/test1
- \<Bs>
-# Cursor at Test1/test2
- \<Bs>
-# Cursor at Contents/test1
-# Finished
- \<Bs>
- \<Bs>
- \<Bs>
- \<Bs>
- A 1\<Esc>
- \<Bs>
- A 2\<Esc>
- \<Bs>
- A 3\<Esc>
- \<Bs>
- A 4\<Esc>
-
-Expect (After too many <Bs>, cursor stays at the first <Enter> spot in first file: Contents/test1):
- # Contents
-
- - [Test1](#Test1) 1 2 3 4
- - [Test2](#Test2)
-
- # Test1 first test1
-
- - [Test1](#Test1)
- - [Test2](#Test2) second test1/test2
- - [filenew](filenew)
-
- # Test2 first test2
-
- - [Test1](#Test1) second test2/test1
- - [Test2](#Test2)
- - [filenew](filenew)
-
-Given vimwiki (link to self):
- - [Bad link](Very bad.html)
- - [My own file](wiki_test)
- - [Test1](#Test1)
- - [Test2](#Test2)
-
-Do (Follow link to self and append chars):
- \<Tab>
- \<Tab>
- \<Enter>
- a this_is_18_chars \<Esc>
-
-Expect (Some chars appended at self link):
- - [Bad link](Very bad.html)
- - [ this_is_18_chars My own file](wiki_test)
- - [Test1](#Test1)
- - [Test2](#Test2)
-
-# vim: foldmethod=marker foldlevel=30 sw=2
diff --git a/test/link_renaming.vader b/test/link_renaming.vader
@@ -0,0 +1,283 @@
+# VimwikiRenameFile
+# Related to link, file navigation
+# Many commands are made with Do: They block with Execute
+
+
+# Create directories I remove at end {{{1
+##########################################
+
+Execute (Copy Wiki's Resources):
+ Log "Start: Copy Resources"
+ call CopyResources()
+
+
+Execute (Mkdir dir1 dir2 dir11 dir12):
+ call system("mkdir $HOME/testmarkdown/dir1")
+ call system("mkdir $HOME/testmarkdown/dir1/dir11")
+ call system("mkdir $HOME/testmarkdown/dir1/dir12")
+ call system("mkdir $HOME/testmarkdown/dir2")
+
+
+# Test Transdirectory and argument {{{1
+# New feature #926
+
+# Create smaller unit {{{2
+
+# we stick all along with these 3 files,
+# Follow them !
+Execute (Create 3 files):
+ edit $HOME/testmarkdown/Test-Rename-zzz.md
+ call WriteMe()
+ edit $HOME/testmarkdown/dir1/dir11/Test-Rename.md
+ call WriteMe()
+ edit $HOME/testmarkdown/Test-Rename-Completion.md
+ call WriteMe()
+
+
+Do (Testing Old buffer has been wiped out {{{2):
+ :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
+ :Log 'Get current Buffer'\<Cr>
+ :let buf_old = bufnr('%')\<Cr>
+ :Log 'Is this wiki 2'\<Cr>
+ :AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<Cr>
+ :Log 'Delete for loosers'\<Cr>
+ :call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')\<Cr>
+ :Log 'Rewrite ...'\<Cr>
+ :call WriteMe()\<Cr>
+ :Log 'Rename 1'\<Cr>
+ :VimwikiRenameFile Test-Rename-new1\<Cr>
+ :Log 'Assert 1'\<Cr>
+ :AssertEqual 'Test-Rename-new1', expand('%:t:r')\<Cr>
+ :Log 'Rename 2'\<Cr>
+ :VimwikiRenameFile Test-Rename-Completion\<Cr>
+ :Log 'Assert 2'\<Cr>
+ :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
+
+Do (Testing Completion {{{2):
+# Rename and test (zzz)
+ :VimwikiRenameFile Test-Rename-z\<C-l>1\<Cr>
+ :AssertEqual $HOME . '/testmarkdown/Test-Rename-zzz1.md', expand('%')\<CR>\<Esc>
+# Restore old name
+ :call WriteMe()\<Cr>
+ :VimwikiRenameFile Test-Rename-zzz\<Cr>
+
+
+Do (Testing transforward {{{2):
+ :Log 'Forward: root -> dir1/dir11 {{{3'\<Cr>
+# Create dir1/dir11/Test-Rename and link to it
+ :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
+ ggdG
+ idir1/dir11/Test-Rename.md\<Esc>
+ \<Cr>\<Cr>
+ :VimwikiRenameFile ../Test-Rename-2\<Cr>
+ :AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-2.md'\<CR>\<Esc>
+
+# See what happend in root
+ :call WriteMe()\<Cr>
+ :edit $HOME/testmarkdown/Test-Rename-Completion.md\<Cr>
+ :AssertEqual getline(1), '[dir1 dir11 Test Rename](dir1/Test-Rename-2.md)'\<Cr>
+
+ :Log 'Backward dir1/dir11 -> root {{{3'\<Cr>
+# See what happend in dir1/dir11
+# I am in root so pressing Enter sends me to dir1/dir11
+ \<Cr>
+# Write forward path
+ dd
+ i../Test-Rename-Completion\<Esc>
+# Convert it to link
+ 0\<Cr>\<Cr>
+
+# Now in root
+ :AssertEqual expand('%'), $HOME . '/testmarkdown/Test-Rename-Completion.md'\<Cr>
+ :VimwikiRenameFile dir1/Test-Rename-Completion-2\<Cr>
+ :AssertEqual expand('%'), $HOME . '/testmarkdown/dir1/Test-Rename-Completion-2.md'\<Cr>
+
+
+Execute (Delete smaller unit changed {{{2):
+ call DeleteFile('$HOME/testmarkdown/Test-Rename-new1.md')
+ call DeleteFile('$HOME/testmarkdown/Test-Rename-zzz.md')
+ call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-Completion_2.md')
+ call DeleteFile('$HOME/testmarkdown/dir1/Test-Rename-2.md')
+
+
+# VimwikiRename Test same directory {{{1
+# Old big conf, from bad unit test design
+# Changing file in a single dir
+# Feel free to modify but as long as it works
+# I delay the cleaning
+####################################
+
+Given vimwiki (Void):
+
+
+Execute (Create Test-Rename -> dir1/dir11/in_dir11.md and dir1/dir12/in_dir12.md and dir2/in_dir2.md):
+ edit $HOME/testmarkdown/Test-Rename.md
+ AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')
+ AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
+ AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
+ call append(0, ['# Test Rename', 'in_root.md', 'dir1/dir11/in_dir11.md', 'dir1/dir12/in_dir12.md', 'dir2/in_dir2.md'])
+ call WriteMe()
+
+Do (Create in_root):
+ :Log 'Open Test-Rename.md'\<CR>
+ :edit $HOME/testmarkdown/Test-Rename.md\<CR>
+ :AssertEqual $HOME . '/testmarkdown/Test-Rename.md', expand('%')\<CR>\<Esc>
+
+ :Log 'Delete last line (easyer latter checks without trailing spaces)'\<CR>
+ Gdd
+
+ :Log 'Open in_root.md'\<CR>
+ gg
+ j\<CR>
+ j\<CR>
+ j\<CR>
+ j\<CR>
+ ggj0y$
+ :AssertEqual '[in_root](in_root.md)', @"\<CR>
+ 0\<CR>
+ :AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
+
+ :Log 'Add link in_root.md -> dir1/dir11/in_dir11'\<CR>
+ ggi# Title in root\<CR>\<Esc>
+ idir1/dir11/in_dir11\<Esc>
+ :call WriteMe()\<CR>
+ :AssertEqual $HOME . '/testmarkdown/in_root.md', expand('%')\<CR>
+
+ :Log 'Open in_dir11.md: creating dirs'\<CR>
+ ggj"ay$
+ :AssertEqual 'reg dir1/dir11/in_dir11', 'reg ' . @a\<CR>
+ 0\<CR>\<CR>
+ :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
+
+ :Log 'One backspace for fun'\<CR>
+ \<BS>
+ :AssertEqual 'file ' . $HOME . '/testmarkdown/in_root.md', 'file ' . expand('%')\<CR>
+
+
+Do (Create dir_11 -> dir_11):
+ :edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md\<CR>
+
+ :Log 'Add link in_dir11_fix.md -> in_dir11'\<CR>
+ ggi# Title in dir11 fix\<CR>\<Esc>
+ iin_dir11\<Esc>
+ :call WriteMe()\<CR>
+
+ :Log 'Open in_dir11.md: creating dirs'\<CR>
+ ggj"ay$
+ :AssertEqual 'reg in_dir11', 'reg ' . @a\<CR>
+ 0\<CR>\<CR>
+ y\<CR>
+ :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
+
+ :Log 'One backspace for fun'\<CR>
+ \<BS>
+ :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11_fix.md', 'file ' . expand('%')\<CR>
+
+
+Execute (Fill in_dir11 content):
+ edit $HOME/testmarkdown/dir1/dir11/in_dir11.md
+ call append(0, ['# Title in_dir11', '[dir2 link](../../dir2/in_dir2.md)'])
+ call WriteMe()
+
+
+# Rename local {{{1
+###################
+
+Do (RenameLink in_dir11 -> in_dir11_new):
+ :edit $HOME/testmarkdown/dir1/dir11/in_dir11.md\<CR>
+ :AssertEqual 'file ' . $HOME . '/testmarkdown/dir1/dir11/in_dir11.md', 'file ' . expand('%')\<CR>
+ :AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')\<CR>
+
+ :Log 'Rename'\<CR>
+ :call WriteMe()\<CR>
+ :VimwikiRenameFile\<CR>
+ y\<CR>
+ in_dir11_new\<CR>
+ :call WriteMe()\<Cr>
+
+ :Log 'Append filename'\<CR>
+ :call append('$', [expand('%')])\<CR>
+
+
+Expect(With new filename at the end):
+ # Title in_dir11
+ [dir2 link](../../dir2/in_dir2.md)
+
+ /home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
+
+
+Execute (edit in_dir11_fix):
+ edit $HOME/testmarkdown/dir1/dir11/in_dir11_fix.md
+
+Expect(Link to in_dir11_new):
+ # Title in dir11 fix
+ [in_dir11](in_dir11_new)
+
+
+Execute (edit Test-Rename.md):
+ edit $HOME/testmarkdown/Test-Rename.md
+
+
+Expect (Link to in_dir11_new):
+ # Test Rename
+ [in_root](in_root.md)
+ [dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
+ [dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
+ [dir2 in_dir2](dir2/in_dir2.md)
+
+
+Do (in_dir2 -> in_dir2_new):
+ :edit $HOME/testmarkdown/dir2/in_dir2.md\<CR>
+
+ :Log 'Append filename'\<CR>
+ :call append('$', [expand('%')])\<CR>
+
+ :Log 'Rename'\<CR>
+ :call WriteMe()\<CR>
+ :VimwikiRenameFile\<CR>
+ y\<CR>
+ in_dir2_new\<CR>
+ :call WriteMe()\<Cr>
+
+ :Log 'Append filename'\<CR>
+ :call append('$', [expand('%')])\<CR>
+
+
+Expect (old and new filenames):
+
+ /home/vimtest/testmarkdown/dir2/in_dir2.md
+ /home/vimtest/testmarkdown/dir2/in_dir2_new.md
+
+Execute (edit Test-Rename.md):
+ edit $HOME/testmarkdown/Test-Rename.md
+
+
+Expect (Link to in_dir11_new):
+ # Test Rename
+ [in_root](in_root.md)
+ [dir1 dir11 in_dir11](dir1/dir11/in_dir11_new.md)
+ [dir1 dir12 in_dir12](dir1/dir12/in_dir12.md)
+ [dir2 in_dir2](dir2/in_dir2_new.md)
+
+
+Execute (edit in_dir11.md):
+ edit $HOME/testmarkdown/dir1/dir11/in_dir11_new.md
+
+
+Expect (Link to in_dir2_new):
+ # Title in_dir11
+ [dir2 link](../../dir2/in_dir2_new.md)
+
+ /home/vimtest/testmarkdown/dir1/dir11/in_dir11_new.md
+
+
+Execute (Clean dir1 and dir2):
+ Log "End: Clean"
+ call DeleteHiddenBuffers()
+ call system('rm $HOME/testmarkdown/Test-Rename.md')
+ call system('rm $HOME/testmarkdown/in_root.md')
+ call system('rm -r $HOME/testmarkdown/dir1')
+ call system('rm -r $HOME/testmarkdown/dir2')
+
+
+# vim: sw=2 foldmethod=marker foldlevel=30 foldignore=#
diff --git a/test/command_toc.vader b/test/link_toc.vader
diff --git a/test/list_VimwikiReturn.vader b/test/list_return.vader
diff --git a/test/run_tests.sh b/test/run_tests.sh
@@ -5,6 +5,7 @@
# Say Hi
echo -en "Starting $(basename $0) for VimWiki\n"
+start_time=`date +%s`
# For windows: Cmder bash is appending busybox to the path and
# and a smlll vim is included, so that override the windows path vim
@@ -28,8 +29,8 @@ printHelp() {
separating versions with a space. E.g. -n "vim1 vim2".
Default is all available versions.
- -f (File) Comma seperated list of tests to run.
- E.g. -o "list_margin,command_toc"
+ -f (File) Space separated list of tests to run.
+ E.g. -o "list_* z_success"
-l (List) list available versions that can be used with the '-n' option
@@ -38,7 +39,7 @@ printHelp() {
-v (Verbose) Turn on verbose output.
E.g. On Linux
- bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader,issue_markdown.vader
+ bash run_tests.sh -v -t vader -n "vim_7.4.1099 vim_8.1.0519" -f link_creation.vader issue_markdown.vader
E.g. On Windows
bash run_tests.sh -v -t vader -n local -f z_success.vader | cat
EOF
@@ -59,12 +60,16 @@ runVader() {
# Parse tests files to execute
if [[ -z $file_test ]]; then
- ind="test/independent_runs/*.vader"
- res="test/*"
+ ind="test/independent_runs/*.vader"
+ res="test/*"
else
- IFS=',' read -ra TEST <<< "$file_test"
+ read -ra TEST <<< "$file_test"
for i in "${TEST[@]}"; do
- if [[ -f "$i" ]]; then
+ if [[ "$i" == "independent_runs/"*"*"* ]]; then
+ ind="$ind test/${i}"
+ elif [[ "$i" == *"*"* ]]; then
+ res="$res test/${i}"
+ elif [[ -f "$i" ]]; then
res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader"
@@ -77,11 +82,11 @@ runVader() {
fi
done
fi
- echo "Vader: will run files: $res and independently $ind"
# Run tests for each specified version
for v in $vers; do
- echo -e "\nRunning version: $v"
+ echo -e "\n\nRunning version: $v"
+ echo -e "============================="
# Set local environment variables
if [[ "$v" == "local" ]]; then
@@ -98,15 +103,24 @@ runVader() {
export ROOT="$tmp_dir/vader_wiki/"
export HOME="$tmp_dir/vader_wiki/home"
vim="vim"
- vim_opt="-u ~/test/vimrc -i NONE"
+ vim_opt="-u ~/test/vimrc"
else
# Only set dockerized vars
export ROOT="/" # So no if in vimrc
vim="/vim-build/bin/$v"
- vim_opt="-u test/vimrc -i NONE"
+ vim_opt="-u test/vimrc"
fi
- set -o pipefail
+ # Too talkative TODO make a verbose level 1..10 an 1 is not taking vim
+ #if [[ "$verbose" != 0 ]]; then
+ # vim_opt+=' -V1'
+ #fi
+ # IDK why vim with -Es is returning ! and make fail:
+ # -- tabnext profiling
+ # -- map.vim
+ vim_opt+=' -i NONE -Es '
+
+ # set -o pipefail
# Copy the resources to temporary directory
if [[ "$v" == "local" ]]; then
@@ -124,41 +138,50 @@ runVader() {
fi
# Run batch of tests
- if [[ "$v" == "local" ]]; then
- pushd $tmp_dir/vader_wiki/testplugin
-
- # Run the tests
- echo -e "\nStarting vim with Vader"
- "$vim" $vim_opt "+Vader! ${res}" 2>&1
- err=$(( $err | $? ))
-
- popd
- else # In docker
- echo -e "\nStarting docker with vim with Vader"
- docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
- "$v" $vim_opt "+Vader! ${res}" 2>&1 | vader_filter | vader_color
- err=$(( $err | $? ))
+ if [[ "$res" != "" ]]; then
+ if [[ "$v" == "local" ]]; then
+ pushd $tmp_dir/vader_wiki/testplugin
+
+ # Run the tests
+ echo -e "\nStarting Batch Vim/Vader <- $res"
+ "$vim" $vim_opt "+Vader! ${res}" 2>&1
+ ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
+ echo -e "\nReturned Batch Vim/Vader -> $ret"
+
+ popd
+ else
+ # In docker
+ echo -e "\nStarting Independant Vim/Vader <- $res"
+ docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
+ "$v" $vim_opt "+Vader! ${res}" 2>&1 | vader_filter | vader_color
+ ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
+ echo -e "\nReturned Independant Docker/Vim/Vader -> $ret"
+ fi
fi
# Run Tests that must be run in individual vim instances
# see README.md for more information
- test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done"
- if [[ "$v" == "local" ]]; then
- pushd $tmp_dir/vader_wiki/testplugin
-
- echo "Starting vim with Vader"
- bash -c "$test_cmd" 2>&1
- err=$(( $err | $? ))
-
- popd
- else # In docker
- echo "Starting docker with vim with Vader"
- docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
- /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
- err=$(( $err | $? ))
+ if [[ "$ind" != "" ]]; then
+ test_cmd="for VF in ${ind}; do $vim $vim_opt \"+Vader! \$VF\"; done"
+ if [[ "$v" == "local" ]]; then
+ pushd $tmp_dir/vader_wiki/testplugin
+
+ echo -e "\nStarting Vim/Vader <- $test_cmd"
+ bash -c "$test_cmd" 2>&1
+ ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
+ echo -e "\nReturned Vim/Vader -> $ret"
+
+ popd
+ else # In docker
+ echo -e "\nStarting Docker/Vim/Vader <- $test_cmd"
+ docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${flags[@]}" \
+ /bin/bash -c "$test_cmd" 2>&1 | vader_filter | vader_color
+ ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
+ echo -e "\nReturned Docker/Vim/Vader -> $ret"
+ fi
fi
- set +o pipefail
+ #set +o pipefail
# Restore what must (I know it should be refactored in a while)
if [[ "$v" == "local" ]]; then
@@ -186,43 +209,44 @@ runVint() {
}
getVers() {
+ # Get all possible version <- Dockerfile
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
}
vader_filter() {
# Filter Vader Stdout
local err=0
- while read -r; do
+ # Keep indentation
+ local IFS=''
+ while read -r REPLY; do
# Print only possible error cases
- if [[ "$verbose" == 0 ]]; then
- if [[ "$REPLY" = *'docker:'* ]] || \
- [[ "$REPLY" = *'Starting Vader:'* ]] || \
- [[ "$REPLY" = *'Vader error:'* ]] || \
- [[ "$REPLY" = *'Vim: Error '* ]]; then
- echo "$REPLY"
- elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
- [[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
- echo "$REPLY"
+ if [[ "$REPLY" = *'docker:'* ]] || \
+ [[ "$REPLY" = *'Starting Vader:'* ]] || \
+ [[ "$REPLY" = *'Vader error:'* ]] || \
+ [[ "$REPLY" = *'Vim: Error '* ]]; then
+ echo "$REPLY"
+ elif [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
+ [[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
+ echo "$REPLY"
+ err=1
+ elif [[ "$REPLY" = *'Success/Total:'* ]]; then
+ success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
+ total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
+ if [ "$success" -lt "$total" ]; then
err=1
- elif [[ "$REPLY" = *'Success/Total:'* ]]; then
- success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
- total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
- if [ "$success" -lt "$total" ]; then
- err=1
- fi
- echo "$REPLY"
fi
- else
+ echo "$REPLY"
+ elif [[ "$verbose" != 0 ]]; then
# just print everything
echo "$REPLY"
fi
done
if [[ "$err" == 1 ]]; then
- echo ""
- echo "!---------Failed tests detected---------!"
- echo "Run with the '-v' flag for verbose output"
- echo ""
+ echo -e "\033[0;31m"
+ echo -e "!---------Failed tests detected---------!"
+ echo -e "Run with the '-v' flag for verbose output"
+ echo -e "\033[0m"
fi
return $err
}
@@ -329,24 +353,24 @@ trap exit 1 SIGINT SIGTERM
# Global error return of the script
o_error=0
-# select which tests should run
+# Select which tests should run
case $type in
"vader" )
runVader ; err=$?
- echo "Vader: returned $err"
+ echo "Main Vader: returned $err"
o_error=$(( $err | $o_error ))
;;
"vint" )
runVint ; err=$?
- echo "Vint: returned $err"
+ echo "Main Vint: returned $err"
o_error=$(( $err | $o_error ))
;;
"all" )
runVint ; err=$?
- echo "Vint: returned $err"
+ echo "Main Vint: returned $err"
o_error=$(( $err | $o_error ))
runVader ; err=$?
- echo "Vader: returned $err"
+ echo "Main Vader: returned $err"
o_error=$(( $err | $o_error ))
;;
* )
@@ -354,6 +378,11 @@ case $type in
exit 1
esac
+# Calcultate time
+end_time=`date +%s`
+sec_time=$((end_time - start_time))
+printf -v script_time '%dh:%dm:%ds' $(($sec_time/3600)) $(($sec_time%3600/60)) $(($sec_time%60))
+
# Exit
-echo "Script $(basename $0) exiting: $o_error"
+echo -ne "Script $(basename $0), in $script_time, Returned -> $o_error\n\n"
exit $o_error
diff --git a/test/tabnext_delay.vader b/test/tabnext_delay.vader
@@ -1,30 +0,0 @@
-# See Issue #580
-
-Execute (Set fold method):
- let g:vimwiki_folding = 'expr:quick'
- call ReloadVimwiki()
-
-Execute (Expect < 0.5 second delay: Issue #580):
- " prep
- edit test/resources/delay.wiki
- normal! 50%
-# TODO set ft and set wiki syntax or this error (no fold found)
-# normal! zozo
- tabedit
-
- " run test
- let start = reltime()
- tabprev
- redraw
- let end = str2float(reltimestr(reltime(start)))
-
- " cleanup
- bdelete test/resources/delay.wiki
-
- " verify
- Log 'Elapsed time = ' . string(end)
- Assert end < 0.5, 'Took longer than expected: ' . string(end) . ' seconds'
-
-Execute (Reset variables):
- let g:vimwiki_folding = ''
- call ReloadVimwiki()
diff --git a/test/vimrc b/test/vimrc
@@ -1,9 +1,18 @@
+" TODO treat if local (see $HOME in all tests)
+" TODO mutualise call CopyResources()
+" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
+" TODO test tabnext in at least one travis job (without -Es)
+" TODO (idea) fasten travis difefrent job with the same vimwiki git (-8s)
+
" Declare tipical Vim preambule
" vint: -ProhibitSetNoCompatible
set nocompatible
filetype plugin indent on
syntax enable
+" Usefull var: for one day, making tests on local
+ let $TPLUGIN = '/testplugin'
+ let $THOME = $HOME
" Set chrooted virtual runtime path
let rtp=$ROOT.'/rtp.vim'
@@ -43,9 +52,12 @@
" Register the 3 wikis
let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki]
+ let g:vimwiki_list_vimrc = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki]
" Set basic settings
+ " Avoid more prompt
+ set nomore
set backspace=indent,eol,start
set wildmode=longest:full,full
set wildmenu
@@ -119,8 +131,24 @@
" this is needed if running manually multiple times
nmapclear
- unlet g:loaded_vimwiki
- source plugin/vimwiki.vim
+ " UNlet what can be
+ for i in ['g:vimwiki_commentstring',
+ \ 'b:did_ftplugin',
+ \ 'g:loaded_vimwiki',
+ \ 'g:vimwiki_global_vars',
+ \ 'g:vimwiki_wikilocal_vars',
+ \ 'g:vimwiki_syntax_variables',
+ \ ]
+ if exists(i)
+ exe 'unlet ' . i
+ endif
+ endfor
+
+ " Reset list
+ let g:vimwiki_list = g:vimwiki_list_vimrc
+
+ " Source plugin: Go
+ runtime! plugin/vimwiki.vim
endfunction
function! ReloadVars()
@@ -165,7 +193,7 @@
catch | endtry
" Delete Buffer
try
- execute 'bdelete! ' . path
+ execute 'bwipeout! ' . path
catch | endtry
endfunction