commit 8e5274b1a2ca100e8003ac207c8590d308e4a2d2
parent 817641e55149248db2763c360c581bcf187d5e42
Author: Tinmarino <tinmarino@gmail.com>
Date: Sun, 23 Aug 2020 03:42:02 -0400
Test: Batchify all && Lint run_test.sh
All tests in the same batch, in other words, no independant test
Diffstat:
14 files changed, 624 insertions(+), 724 deletions(-)
diff --git a/test/config_vars.vader b/test/config_vars.vader
@@ -6,7 +6,6 @@ Given txt (txt):
txt
Execute (VimWei vars #980):
- call CopyResources()
" Set
call UnloadVimwiki()
let wiki = {}
@@ -52,7 +51,7 @@ Execute (VimWei vars #980):
bprevious
Log 'Path (Current): ' . getcwd()
Log 'File (Buffer):' . @%
- bdelete index.md
+ bwipeout index.md
" Clean
Log 'Clean up'
diff --git a/test/file_goto.vader b/test/file_goto.vader
@@ -5,11 +5,6 @@
# 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
@@ -78,7 +73,6 @@ Execute (:VimwikiGoto + Completion in directory):
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
@@ -1,10 +1,5 @@
# Travel thought files
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
-
Given (Void for Accessing other files within vimwiki #979 {{{1):
@@ -29,7 +24,4 @@ Do (At Index: Create and goto markdownfile):
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/html_blockquote.vader b/test/html_blockquote.vader
@@ -1,9 +1,5 @@
# Blockquotes in html convertion
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
Given (Void):
Execute (Edit TestHtml Wiki):
diff --git a/test/html_convert_default.vader b/test/html_convert_default.vader
@@ -1,9 +1,5 @@
# Conertion: Wiki -> Html
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
#################################################
Given vimwiki (Comments):
This is some text
diff --git a/test/html_diary_rss_feed.vader b/test/html_diary_rss_feed.vader
@@ -1,9 +1,5 @@
# 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):
@@ -21,8 +17,9 @@ Do (Get HTML file):
kdgg
# Delete everything below
jdG
-# Save (Not necessary)
- :write
+# Save (Not necessary) => Actually make rest of batch freeze, do you really want
+# to quit buffer
+# :write
Expect (RSS link in HTML):
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
@@ -34,7 +31,7 @@ Do (Get RSS feed):
# Replace pubDate with dummy as it's based on file modification time
:%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
# Save (Not necessary)
- :write
+# :write
Expect (RSS):
# TODO the next line is deleted with -Es
@@ -107,3 +104,6 @@ Expect (RSS):
</item>
</channel>
</rss>
+
+Execute (Clean buffer modification):
+ edit! $HOME/testwiki/index.wiki
diff --git a/test/independent_runs/map.vader b/test/independent_runs/map.vader
@@ -1,615 +0,0 @@
-# Maps
-# TODO make it without side effects
-# -- Use the normal vimwiki or reset it
-
-
-# 0 Configure {{{1
-##################
-
-Execute (Configure: Set vimwiki list to markdown resource):
- Log "Let mapleader = ,"
- let mapleader = ','
-
- Log "Destroy vimrc or previous run heritage"
- call DestroyVar('g:vimwiki_list')
- call DestroyVar('g:vimwiki_global_vars')
- call DestroyVar('g:vimwiki_wikilocal_vars')
-
- Log "Destroy vimrc variable, works better that way"
- call DestroyVar('g:vimwiki_default')
- call DestroyVar('g:vimwiki_markdown')
- call DestroyVar('g:vimwiki_mediawiki')
-
- Log "Declare my vimwiki_list"
- let g:vimwiki_list = [{
- \ 'path': 'test/resources/testmarkdown',
- \ 'syntax': 'markdown',
- \ 'ext': '.md'
- \ }]
-
- Log "Declare my extension for temporary wiki"
- let g:vimwiki_ext2syntax = {'.md': 'markdown'}
-
- Log "Reload vimwiki"
- 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_syntaxlocal_vars',
- \ ]
- 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)
-
-Execute (VimwikiIndex):
- VimwikiIndex 1
- AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
- AssertEqual 'vimwiki', &filetype
- AssertEqual 'test/resources/testmarkdown/', vimwiki_wikilocal_vars[0]['path']
- AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
-
-Execute (Open buzz bozz):
- edit test/resources/testmarkdown/buzz_bozz.md
- AssertEqual 'test/resources/testmarkdown/buzz_bozz.md', expand('%')
-
-
-# 1 Global {{{1
-###############
-
-Execute (===========================================================):
- Log "Checking global map"
-
-Do (,ww -> open index [Assert]):
- ,ww
- :AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,wt -> open index in tab [Assert]):
- ,wt
- :AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
- \<CR>
- :call AssertTab(2)
- \<CR>
-
-Do (,w,w -> open diary [Assert]):
- ,w,w
- :AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,w,t -> open diary in tab [Assert]):
- ,w,t
- :AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
- \<CR>
- :call AssertTab(2)
- \<CR>
-
-Do (,ws -> list and select wiki [Assert]):
- ,ws
- 1
- \<CR>
- :AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,wi -> open diary index [Assert]):
- ,wi
- :AssertEqual 'test/resources/testmarkdown/diary/diary.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,w,y -> open yesterday [Assert]):
- ,w,y
- :AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() - 60*60*24) . '.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,w,m -> open tomorrow [Assert]):
- ,wm
- :AssertEqual 'test/resources/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() + 60*60*24) . '.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-
-# 2 Local {{{1
-##############
-
-Execute (===========================================================):
- Log "Checking local map"
-
-
-# 2.1 Heading {{{2
-##############
-
-
-Do (,wn -> Create new wiki [Assert]):
- ,wn
- new_file1
- \<CR>
- :AssertEqual 'test/resources/testmarkdown/new_file1.md', expand('%')
- \<CR>
- :call AssertTab(1)
- \<CR>
-
-Do (,wd -> Delete wiki yes [Assert]):
- :edit 'test/resources/testmarkdown/file_new1.md'
- \<CR>
-
- ,wn
- new_file2
- \<CR>
- ithis is content 2
- \<Esc>
-
- ,wd
- yes
- \<CR>
-
- :AssertEqual 'test/resources/testmarkdown/index.md', expand('%')
- \<CR>
-
-Do (,wd -> Delete wiki no [Assert]):
- :edit 'test/resources/testmarkdown/file_new1.md'
- \<CR>
-
- ,wn
- new_file2
- \<CR>
- ithis is content 1
- \<Esc>
-
- ,wd
- no
- \<CR>
-
- :AssertEqual 'test/resources/testmarkdown/new_file2.md', expand('%')
- \<CR>
-
-Do (,wn -> Rename wiki [Assert]):
- ,wn
- new_file1
- \<CR>
- ithis is content 1
- \<Esc>
-
- ,wn
- new_file2
- \<CR>
-
- :AssertEqual 'test/resources/testmarkdown/new_file2.md', expand('%')
- \<CR>
-
-Given (Some headings):
- # Head 1
- ## Head 1.1
- content 1
-
- # Head2
- content 2
-
-Execute (file .md):
- file toto.md
- edit!
- AssertEqual 'vimwiki', &ft
-
-Do (= -> add header level):
- =
-
-Expect (Inc header level):
- ## Head 1
- ## Head 1.1
- content 1
-
- # Head2
- content 2
-
-Do (- -> Dec header level):
- j
- -
-
-Expect (Dec header level):
- # Head 1
- # Head 1.1
- content 1
-
- # Head2
- content 2
-
-# TODO fix for vim_7.3.429
-# Do ([[ -> Go to the previous header):
-# G
-# k
-# [[
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1
-# ## Head 1.1 placeholder
-# content 1
-#
-# # Head2
-# content 2
-#
-# Do (]] -> Go to the next header):
-# ]]
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1
-# ## Head 1.1 placeholder
-# content 1
-#
-# # Head2
-# content 2
-#
-# Do ([= -> Go to the previous header which has the same level):
-# G
-# k
-# [=
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1 placeholder
-# ## Head 1.1
-# content 1
-#
-# # Head2
-# content 2
-#
-# Do (]= -> Go to the next header which has the same level):
-# ]=
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1
-# ## Head 1.1
-# content 1
-#
-# # Head2 placeholder
-# content 2
-#
-# Do (]u Go one level up):
-# j
-# ]u
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1 placeholder
-# ## Head 1.1
-# content 1
-#
-# # Head2
-# content 2
-#
-# Do ([u Go one level up):
-# j
-# [u
-# A placeholder
-#
-# Expect (placeholder):
-# # Head 1 placeholder
-# ## Head 1.1
-# content 1
-#
-# # Head2
-# content 2
-
-
-# 2.2 List {{{2
-##############
-
-
-
-Given vimwiki (Completion list #813 {{{3):
- complete1
- complete2
- complete3
-
-Do (Insert a list item and complete):
- Go
- * 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
- complete2
- complete3
- * complete2
-
-
-Given (Number list):
- 1. I
- 1. Relly
- 2. Love
- 1. Very
- 1. Much
- 3. You
-
-Execute (file .md):
- file toto.md
- edit!
- AssertEqual 'vimwiki', &ft
- set sw=2
-
-Do (gll):
- gll
-
-Expect (Increase):
- 1. I
- 2. Relly
- 1. Love
- 1. Very
- 1. Much
- 2. You
-
-Do (gLl):
- gLl
-
-Expect (Increase self + child):
- 1. I
- 1. Relly
- 1. Love
- 1. Very
- 1. Much
- 2. You
-
-Do (glh):
- jjj
- glh
-
-Expect (Decrease):
- 1. I
- 1. Relly
- 2. Love
- 3. Very
- 1. Much
- 4. You
-
-Do (gLh):
- jjj
- gLh
-
-Expect (Decrease self + child):
- 1. I
- 1. Relly
- 2. Love
- 3. Very
- 1. Much
- 4. You
-
-Do (glr):
- \<C-A>\<C-A>
- glr
-
-Expect (Renumber):
- 1. I
- 1. Relly
- 2. Love
- 1. Very
- 1. Much
- 3. You
-
-
-# New launch
-#
-Given (Number list):
- 1. I
- 1. Relly
- 2. Love
- 1. Very
- 1. Much
- 3. You
-
-Execute (file .md):
- file toto.md
- edit!
- AssertEqual 'vimwiki', &ft
- set sw=2
-
-Do (gl*):
- gl*
-
-Expect (item -> *):
- * I
- 1. Relly
- 1. Love
- 1. Very
- 1. Much
- 2. You
-
-Do (gL*):
- gL*
-
-Expect (list -> *):
- * I
- 1. Relly
- * Love
- 1. Very
- 1. Much
- * You
-
-# New launch
-#
-Given (Bulleted list):
- * I
- - Relly
- * Love
- - Very
- + Much
- * You
-
-Execute (file .md):
- set sw=2
- file toto.md
- edit!
- let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
- let g:vimwiki_syntaxlocal_vars['markdown']['bullet_types'] = ['*', '-', '+']
- AssertEqual 'vimwiki', &ft
-
-Do (gLl):
- gLl
-
-Expect (Increase):
- - I
- + Relly
- * Love
- - Very
- + Much
- * You
-
-Do (3glh):
- gLh
-
-Expect (Decrease):
- * I
- - Relly
- * Love
- - Very
- + Much
- * You
-
-Given (Bulleted list 2):
- * Love
- - Very
- - Much
-
-Do (Go):
- Go
-
-Expect (New item):
- * Love
- - Very
- - Much
- -
-
-
-# New launch
-#
-Given (List ->):
- * Item1
-
-Execute (file toto.md):
- " Note: let s:markdown_syntax.bullet_types = ['*', '-', '+']
- file toto.md
- edit!
- Log "Cycle bullets"
- let g:vimwiki_syntaxlocal_vars['bullet_types'] = ['*', '-']
- let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
- AssertEqual g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'], 1
- AssertEqual 'vimwiki', &ft
- set sw=2
- set expandtab " Otherwise, getting some tab before some items, when enought space
-
-Do (o):
- oItem2
-
-Expect (Good bullet type):
- * Item1
- * Item2
-
-# TODO test more, (see real cycle, but do not work with low vim)
-Do (o + <C-t>):
- o2
- \<C-t>\<Esc>
- o3
- \<C-t>\<Esc>
-
-Expect (Good bullet type):
- * Item1
- - 2
- + 3
-
-Do (o + <Cr>):
- A1\<Cr>
- 2\<C-t>\<Cr>
- 3\<C-t>
-
-Expect (Good nested bullet type):
- * Item11
- - 2
- + 3
-
-
-# TODO test: let g:vimwiki_bullet_types = ['-', '•', '→', '*']
-
-
-# 3 Text Object {{{1
-####################
-
-Execute (===========================================================):
- Log "Checking text object"
-
-# 3.1 HEading Object {{{2
-####################
-
-
-Given (Some headings):
- # Head 1
- ## Head 1.1
- content 1
-
- # Head2
- content 2
-
-Do (ah):
- j
- dah
-
-Expect (Change A header including its content up to the next header):
- # Head 1
- # Head2
- content 2
-
-Do (ih):
- j
- dih
-
-Expect (The content under a header):
- # Head 1
- ## Head 1.1
-
- # Head2
- content 2
-
-Do (aH):
- daH
-
-Expect (A header including all of its subheaders):
- # Head2
- content 2
-
-Do (iH):
- diH
-
-Expect (Like 'aH', but excluding the header itself):
- # Head 1
-
- # Head2
- content 2
-
-# vim: foldmethod=marker foldlevel=30 sw=2
diff --git a/test/link_generation.vader b/test/link_generation.vader
@@ -4,9 +4,7 @@
# - buffer list insertion (see: vimwiki#base#update_listing_in_buffer)
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
+Execute (Reset sw to default (due to batch)):
set sw=8
# 1 VimwikiGenerateLinks {{{1
@@ -198,7 +196,6 @@ Expect (diary index generated):
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')
diff --git a/test/link_renaming.vader b/test/link_renaming.vader
@@ -6,11 +6,6 @@
# 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")
diff --git a/test/map.vader b/test/map.vader
@@ -0,0 +1,568 @@
+# Maps
+# TODO make it without side effects
+# -- Use the normal vimwiki or reset it
+
+
+# 0 Configure {{{1
+##################
+
+Execute (VimwikiIndex):
+ VimwikiIndex 2
+ AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
+ AssertEqual 'vimwiki', &filetype
+ AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[0]['path']
+ AssertEqual $HOME . 'testmarkdown/index.md', expand('%')
+
+Execute (Open buzz bozz):
+ edit $HOME/testmarkdown/buzz_bozz.md
+ AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')
+
+# 1 Global {{{1
+###############
+
+Execute (===========================================================):
+ Log "Checking global map"
+
+Do (,ww -> open index [Assert]):
+ ,ww
+ :AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,wt -> open index in tab [Assert]):
+ ,wt
+ :AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+ \<CR>
+ :call AssertTab(2)
+ \<CR>
+
+Do (,w,w -> open diary [Assert]):
+ ,w,w
+ :AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,w,t -> open diary in tab [Assert]):
+ ,w,t
+ :AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d') . '.md', expand('%')
+ \<CR>
+ :call AssertTab(2)
+ \<CR>
+
+Do (,ws -> list and select wiki [Assert]):
+ ,ws
+ 1
+ \<CR>
+ :AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,wi -> open diary index [Assert]):
+ ,wi
+ :AssertEqual $HOME . '/testmarkdown/diary/diary.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,w,y -> open yesterday [Assert]):
+ ,w,y
+ :AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() - 60*60*24) . '.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,w,m -> open tomorrow [Assert]):
+ ,wm
+ :AssertEqual $HOME . '/testmarkdown/diary/' . strftime('%Y-%m-%d', localtime() + 60*60*24) . '.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+
+# 2 Local {{{1
+##############
+
+Execute (===========================================================):
+ Log "Checking local map"
+
+
+# 2.1 Heading {{{2
+##############
+
+
+Do (,wn -> Create new wiki [Assert]):
+ ,wn
+ new_file1
+ \<CR>
+ :AssertEqual $HOME . '/testmarkdown/new_file1.md', expand('%')
+ \<CR>
+ :call AssertTab(1)
+ \<CR>
+
+Do (,wd -> Delete wiki yes [Assert]):
+ :edit $HOME . '/testmarkdown/file_new1.md'
+ \<CR>
+
+ ,wn
+ new_file2
+ \<CR>
+ ithis is content 2
+ \<Esc>
+
+ ,wd
+ yes
+ \<CR>
+
+ :AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
+ \<CR>
+
+Do (,wd -> Delete wiki no [Assert]):
+ :edit $HOME . '/testmarkdown/file_new1.md'
+ \<CR>
+
+ ,wn
+ new_file2
+ \<CR>
+ ithis is content 1
+ \<Esc>
+
+ ,wd
+ no
+ \<CR>
+
+ :AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
+ \<CR>
+
+Do (,wn -> Rename wiki [Assert]):
+ ,wn
+ new_file1
+ \<CR>
+ ithis is content 1
+ \<Esc>
+
+ ,wn
+ new_file2
+ \<CR>
+
+ :AssertEqual $HOME . '/testmarkdown/new_file2.md', expand('%')
+ \<CR>
+
+Given (Some headings):
+ # Head 1
+ ## Head 1.1
+ content 1
+
+ # Head2
+ content 2
+
+Execute (file .md):
+ file toto.md
+ edit!
+ AssertEqual 'vimwiki', &ft
+
+Do (= -> add header level):
+ =
+
+Expect (Inc header level):
+ ## Head 1
+ ## Head 1.1
+ content 1
+
+ # Head2
+ content 2
+
+Do (- -> Dec header level):
+ j
+ -
+
+Expect (Dec header level):
+ # Head 1
+ # Head 1.1
+ content 1
+
+ # Head2
+ content 2
+
+# TODO fix for vim_7.3.429
+# Do ([[ -> Go to the previous header):
+# G
+# k
+# [[
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1
+# ## Head 1.1 placeholder
+# content 1
+#
+# # Head2
+# content 2
+#
+# Do (]] -> Go to the next header):
+# ]]
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1
+# ## Head 1.1 placeholder
+# content 1
+#
+# # Head2
+# content 2
+#
+# Do ([= -> Go to the previous header which has the same level):
+# G
+# k
+# [=
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1 placeholder
+# ## Head 1.1
+# content 1
+#
+# # Head2
+# content 2
+#
+# Do (]= -> Go to the next header which has the same level):
+# ]=
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1
+# ## Head 1.1
+# content 1
+#
+# # Head2 placeholder
+# content 2
+#
+# Do (]u Go one level up):
+# j
+# ]u
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1 placeholder
+# ## Head 1.1
+# content 1
+#
+# # Head2
+# content 2
+#
+# Do ([u Go one level up):
+# j
+# [u
+# A placeholder
+#
+# Expect (placeholder):
+# # Head 1 placeholder
+# ## Head 1.1
+# content 1
+#
+# # Head2
+# content 2
+
+
+# 2.2 List {{{2
+##############
+
+
+
+Given vimwiki (Completion list #813 {{{3):
+ complete1
+ complete2
+ complete3
+
+Do (Insert a list item and complete):
+ Go
+ * 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
+ complete2
+ complete3
+ * complete2
+
+
+Given (Number list):
+ 1. I
+ 1. Relly
+ 2. Love
+ 1. Very
+ 1. Much
+ 3. You
+
+Execute (file .md):
+ file toto.md
+ edit!
+ AssertEqual 'vimwiki', &ft
+ set sw=2
+
+Do (gll):
+ gll
+
+Expect (Increase):
+ 1. I
+ 2. Relly
+ 1. Love
+ 1. Very
+ 1. Much
+ 2. You
+
+Do (gLl):
+ gLl
+
+Expect (Increase self + child):
+ 1. I
+ 1. Relly
+ 1. Love
+ 1. Very
+ 1. Much
+ 2. You
+
+Do (glh):
+ jjj
+ glh
+
+Expect (Decrease):
+ 1. I
+ 1. Relly
+ 2. Love
+ 3. Very
+ 1. Much
+ 4. You
+
+Do (gLh):
+ jjj
+ gLh
+
+Expect (Decrease self + child):
+ 1. I
+ 1. Relly
+ 2. Love
+ 3. Very
+ 1. Much
+ 4. You
+
+Do (glr):
+ \<C-A>\<C-A>
+ glr
+
+Expect (Renumber):
+ 1. I
+ 1. Relly
+ 2. Love
+ 1. Very
+ 1. Much
+ 3. You
+
+
+# New launch
+#
+Given (Number list):
+ 1. I
+ 1. Relly
+ 2. Love
+ 1. Very
+ 1. Much
+ 3. You
+
+Execute (file .md):
+ file toto.md
+ edit!
+ AssertEqual 'vimwiki', &ft
+ set sw=2
+
+Do (gl*):
+ gl*
+
+Expect (item -> *):
+ * I
+ 1. Relly
+ 1. Love
+ 1. Very
+ 1. Much
+ 2. You
+
+Do (gL*):
+ gL*
+
+Expect (list -> *):
+ * I
+ 1. Relly
+ * Love
+ 1. Very
+ 1. Much
+ * You
+
+# New launch
+#
+Given (Bulleted list):
+ * I
+ - Relly
+ * Love
+ - Very
+ + Much
+ * You
+
+Execute (file .md):
+ set sw=2
+ file toto.md
+ edit!
+ let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
+ let g:vimwiki_syntaxlocal_vars['markdown']['bullet_types'] = ['*', '-', '+']
+ AssertEqual 'vimwiki', &ft
+
+Do (gLl):
+ gLl
+
+Expect (Increase):
+ - I
+ + Relly
+ * Love
+ - Very
+ + Much
+ * You
+
+Do (3glh):
+ gLh
+
+Expect (Decrease):
+ * I
+ - Relly
+ * Love
+ - Very
+ + Much
+ * You
+
+Given (Bulleted list 2):
+ * Love
+ - Very
+ - Much
+
+Do (Go):
+ Go
+
+Expect (New item):
+ * Love
+ - Very
+ - Much
+ -
+
+
+# New launch
+#
+Given (List ->):
+ * Item1
+
+Execute (file toto.md):
+ " Note: let s:markdown_syntax.bullet_types = ['*', '-', '+']
+ file toto.md
+ edit!
+ Log "Cycle bullets"
+ let g:vimwiki_syntaxlocal_vars['bullet_types'] = ['*', '-']
+ let g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'] = 1
+ AssertEqual g:vimwiki_syntaxlocal_vars['markdown']['cycle_bullets'], 1
+ AssertEqual 'vimwiki', &ft
+ set sw=2
+ set expandtab " Otherwise, getting some tab before some items, when enought space
+
+Do (o):
+ oItem2
+
+Expect (Good bullet type):
+ * Item1
+ * Item2
+
+# TODO test more, (see real cycle, but do not work with low vim)
+Do (o + <C-t>):
+ o2
+ \<C-t>\<Esc>
+ o3
+ \<C-t>\<Esc>
+
+Expect (Good bullet type):
+ * Item1
+ - 2
+ + 3
+
+Do (o + <Cr>):
+ A1\<Cr>
+ 2\<C-t>\<Cr>
+ 3\<C-t>
+
+Expect (Good nested bullet type):
+ * Item11
+ - 2
+ + 3
+
+
+# TODO test: let g:vimwiki_bullet_types = ['-', '•', '→', '*']
+
+
+# 3 Text Object {{{1
+####################
+
+Execute (===========================================================):
+ Log "Checking text object"
+
+# 3.1 HEading Object {{{2
+####################
+
+
+Given (Some headings):
+ # Head 1
+ ## Head 1.1
+ content 1
+
+ # Head2
+ content 2
+
+Do (ah):
+ j
+ dah
+
+Expect (Change A header including its content up to the next header):
+ # Head 1
+ # Head2
+ content 2
+
+Do (ih):
+ j
+ dih
+
+Expect (The content under a header):
+ # Head 1
+ ## Head 1.1
+
+ # Head2
+ content 2
+
+Do (aH):
+ daH
+
+Expect (A header including all of its subheaders):
+ # Head2
+ content 2
+
+Do (iH):
+ diH
+
+Expect (Like 'aH', but excluding the header itself):
+ # Head 1
+
+ # Head2
+ content 2
+
+# vim: foldmethod=marker foldlevel=30 sw=2
diff --git a/test/run_tests.sh b/test/run_tests.sh
@@ -4,8 +4,8 @@
# output function.
# Say Hi
-echo -en "Starting $(basename $0) for VimWiki\n"
-start_time=`date +%s`
+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
@@ -60,23 +60,16 @@ runVader() {
# Parse tests files to execute
if [[ -z $file_test ]]; then
- ind="test/independent_runs/*.vader"
res="test/*"
else
read -ra TEST <<< "$file_test"
for i in "${TEST[@]}"; do
- if [[ "$i" == "independent_runs/"*"*"* ]]; then
- ind="$ind test/${i}"
- elif [[ "$i" == *"*"* ]]; then
+ if [[ "$i" == *"*"* ]]; then
res="$res test/${i}"
elif [[ -f "$i" ]]; then
res="$res test/${i}"
elif [[ -f "${i}.vader" ]]; then
res="$res test/${i}.vader"
- elif [[ -f "independent_runs/${i}" ]]; then
- ind="$ind test/independent_runs/${i}"
- elif [[ -f "independent_runs/${i}.vader" ]]; then
- ind="$ind test/independent_runs/${i}.vader"
else
printf "WARNING: Test \"%s\" not found.\n", "$i"
fi
@@ -94,10 +87,10 @@ runVader() {
home_save="$HOME"
# Create temporary root
- mkdir -p $tmp_dir/vader_wiki
- mkdir -p $tmp_dir/vader_wiki/home
- mkdir -p $tmp_dir/vader_wiki/home/test
- mkdir -p $tmp_dir/vader_wiki/testplugin
+ mkdir -p "$tmp_dir/vader_wiki"
+ mkdir -p "$tmp_dir/vader_wiki/home"
+ mkdir -p "$tmp_dir/vader_wiki/home/test"
+ mkdir -p "$tmp_dir/vader_wiki/testplugin"
# Set vars
export ROOT="$tmp_dir/vader_wiki/"
@@ -127,57 +120,40 @@ runVader() {
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
echo -e "\nCopying resources to $ROOT"
# Copy testplugin
- cp -rf $wiki_path/* $ROOT/testplugin/
+ cp -rf "$wiki_path/"* "$ROOT/testplugin/"
# Copy home
- cp -rf $script_path/* $HOME/test/
+ cp -rf "$script_path/"* "$HOME/test/"
# Copy rtp.vim
- cp -rf $script_path/resources/rtp_local.vim $ROOT/rtp.vim
+ cp -rf "$script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
# Copy vader <- internet
echo 'Cloning Vader (git, do not care the fatal)'
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
fi
# Run batch of tests
+ # shellcheck disable=SC2086,SC2206
if [[ "$res" != "" ]]; then
if [[ "$v" == "local" ]]; then
- pushd $tmp_dir/vader_wiki/testplugin
+ pushd "$tmp_dir/vader_wiki/testplugin" \
+ || echo 'Warning pushd testplugin failed'
# Run the tests
- echo -e "\nStarting Batch Vim/Vader <- $res"
- "$vim" $vim_opt "+Vader! ${res}" 2>&1
- ret=${PIPESTATUS[1]}; err=$(( $err + $ret ))
+ acmd=("$vim" $vim_opt \"+Vader! ${res}\" "2>&1")
+ echo -e "\nStarting Batch Vim/Vader:\n${acmd[*]}\n<- $res\n"
+ ${acmd[*]}
+ ret=${PIPESTATUS[1]}; err=$(( err + ret ))
echo -e "\nReturned Batch Vim/Vader -> $ret"
- popd
+ popd \
+ || echo 'Warning popd also failed'
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
- 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"
+ acmd=(docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr"
+ "${flags[@]}" "$v" $vim_opt \"+Vader! ${res}\" "2>&1")
+ echo -e "\nStarting Batch Vim/Vader:\n${acmd[*]}\n<- $res\n"
+ ${acmd[*]} | vader_filter | vader_color
+ ret=${PIPESTATUS[1]}; err=$(( err + ret ))
+ echo -e "\nReturned Batch Docker/Vim/Vader -> $ret"
fi
fi
@@ -196,14 +172,16 @@ runVint() {
cmd="vint -s . && vint -s test/vimrc"
if echo "$vers" | grep "local" > /dev/null; then
echo -e "\nRunning Vint: $cmd : in $wiki_path"
- pushd $wiki_path > /dev/null
+ pushd "$wiki_path" > /dev/null \
+ || echo 'Warning pushd wiki_path failed'
$cmd
- err=$(( $err | $? ))
- popd > /dev/null
+ err=$(( err | $? ))
+ popd > /dev/null \
+ || echo 'Warning popd also failed'
else
echo -e "\nStarting Docker container and running Vint: $cmd"
docker run -a stdout "${flags[@]}" bash -c "$cmd"
- err=$(( $err | $? ))
+ err=$(( err | $? ))
fi
return $err
}
@@ -287,10 +265,10 @@ vader_color() {
}
# path of the script, supposing no spaces
-script_file="$(dirname $0)"
-script_path="$( realpath $script_file )"
-wiki_path="$( realpath $script_path/.. )"
-tmp_dir=$(dirname $(mktemp -u))
+script_file="$(dirname "$0")"
+script_path="$( realpath "$script_file" )"
+wiki_path="$( realpath "$script_path/.." )"
+tmp_dir="$(dirname "$(mktemp -u)")"
# list of vim/nvim versions
vers="$(getVers)"
@@ -358,20 +336,20 @@ case $type in
"vader" )
runVader ; err=$?
echo "Main Vader: returned $err"
- o_error=$(( $err | $o_error ))
+ o_error=$(( err | o_error ))
;;
"vint" )
runVint ; err=$?
echo "Main Vint: returned $err"
- o_error=$(( $err | $o_error ))
+ o_error=$(( err | o_error ))
;;
"all" )
runVint ; err=$?
echo "Main Vint: returned $err"
- o_error=$(( $err | $o_error ))
+ o_error=$(( err | o_error ))
runVader ; err=$?
echo "Main Vader: returned $err"
- o_error=$(( $err | $o_error ))
+ o_error=$(( err | o_error ))
;;
* )
echo "Error: invalid type - '$type'" 1>&2
@@ -379,10 +357,10 @@ case $type in
esac
# Calcultate time
-end_time=`date +%s`
+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))
+printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
# Exit
-echo -ne "Script $(basename $0), in $script_time, Returned -> $o_error\n\n"
+echo -ne "Script $(basename "$0"), in $script_time, Returned -> $o_error\n\n"
exit $o_error
diff --git a/test/independent_runs/search.vader b/test/search.vader
diff --git a/test/tag.vader b/test/tag.vader
@@ -1,10 +1,6 @@
# Tag generation and navigation
# Note: The Generate must be in Execute
-Execute (Copy Wiki's Resources):
- Log "Start: Copy Resources"
- call CopyResources()
-
Execute (Setup):
set sw=4
AssertEqual 4, &sw
diff --git a/test/vimrc b/test/vimrc
@@ -200,7 +200,7 @@
" Write current file: helper to hide `set bt=`
function! WriteMe()
set buftype=
- write %
+ write! %
endfunction
" Delete a file <- path <string>
@@ -293,4 +293,8 @@
AssertEqual a:one, a:two
endfunction
+
+" Copy Wiki's Resources
+call CopyResources()
+
" vim: ft=vim:sw=2