diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b8fa61e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM tweekmonster/vim-testbed:latest + +ENV PACKAGES="\ + bash \ + git \ + python \ + py-pip \ +" +RUN apk --update add $PACKAGES && \ + rm -rf /var/cache/apk/* /tmp/* /var/tmp/* + +RUN pip install vim-vint +RUN git clone https://github.com/junegunn/vader.vim vader + +RUN install_vim -tag v7.4.1099 -build \ + -tag v8.0.0027 -build \ + -tag v8.1.0519 -build diff --git a/test/Readme.md b/test/Readme.md new file mode 100644 index 0000000..58afdfa --- /dev/null +++ b/test/Readme.md @@ -0,0 +1,26 @@ +# Vimwiki Tests + +This directory contains a test framework used to automatically test/verify +Vimwiki functionality. It is based on the following tools: + +- [vim-testbed](https://github.com/tweekmonster/vim-testbed) +- [Vader](https://github.com/junegunn/vader.vim) + +## Resources + +- [Vim patches](http://ftp.vim.org/pub/vim/patches/) +- Example test cases: + - [vim-easy-align](https://github.com/junegunn/vim-easy-align/tree/master/test) + - [vim-plug](https://github.com/junegunn/vim-plug/tree/master/test) + - [ale](https://github.com/w0rp/ale/tree/master/test) + - [Other projects](https://github.com/junegunn/vader.vim/wiki/Projects-using-Vader) + +## Manual Steps + +To build the Docker image run `docker build -t vimwiki` from the Vimwiki +repository root (same location as the Dockerfile). + +To start the tests run `docker run -it --rm -v $PWD:/testplugin -v $PWD/test:/home vimwiki vim-v7.4.1099 -u test/vimrc -i NONE '+Vader! test/*'` +also from the repository root. + + - Substitute `vim-v7.4.1099` for any of the vim versions in the Dockerfile. diff --git a/test/tabnext_delay.txt b/test/tabnext_delay.txt deleted file mode 100644 index 75339d2..0000000 --- a/test/tabnext_delay.txt +++ /dev/null @@ -1,18 +0,0 @@ -" From https://github.com/vimwiki/vimwiki/pull/601 -$ gvim -u NONE -U NONE -N -i NONE - -set nocompatible -filetype plugin on -syntax on -let g:vimwiki_camel_case = 0 " Don't make links from CamelCased words -let g:vimwiki_table_auto_fmt = 0 " Turn off table auto-formatting -let g:vimwiki_autowriteall = 0 -let g:vimwiki_folding = 'expr:quick' " Enable folding. -let &rtp.=',~/.vim/bundle/vimwiki' -source ~/.vim/bundle/vimwiki/plugin/vimwiki.vim -e ~/tmp/delay.wiki -normal! 50% -normal! zozo -tabe -let start = reltime() | tabprev | redraw | echom reltimestr(reltime(start)) -" >>> expected: less than 0.5 seconds diff --git a/test/tabnext_delay.vader b/test/tabnext_delay.vader new file mode 100644 index 0000000..7c71f45 --- /dev/null +++ b/test/tabnext_delay.vader @@ -0,0 +1,31 @@ +Before (Setup): + let g:vimwiki_folding = 'expr:quick' + + " clear mappings so plugin can be reloaded + " this is needed if running manually multiple times + nmapclear + + " reload the plugin to set the fold method + unlet g:loaded_vimwiki + source plugin/vimwiki.vim + +Execute (Expect < 0.5 second delay: Issue #580): + " prep + edit test/resources/delay.wiki + normal! 50% + normal! zozo + tabedit + + " run test + let start = reltime() + tabprev + redraw + let end = str2float(reltimestr(reltime(start))) + + " cleanup + bdelete test/resources/delay.wiki + tabclose + + " verify + Log 'Elapsed time = ' . string(end) + Assert end < 0.5, 'Took longer than expected: ' . string(end) . ' seconds' diff --git a/test/vimrc b/test/vimrc new file mode 100644 index 0000000..142c4fe --- /dev/null +++ b/test/vimrc @@ -0,0 +1,34 @@ +source /rtp.vim +set runtimepath+=/vader + +" vint: -ProhibitSetNoCompatible +set nocompatible +filetype plugin indent on +syntax enable + +" default syntax +let vimwiki_default = {} +let vimwiki_default.path = '~/vimwiki/default' +let vimwiki_default.path_html = '~/vimwiki/default/html' +let vimwiki_default.syntax = 'default' +let vimwiki_default.ext = '.wiki' +let vimwiki_default.name = 'DefaultSyntax' + +" markdown syntax - https://github.github.com/gfm/ +let vimwiki_markdown = {} +let vimwiki_markdown.path = '~/vimwiki/markdown' +let vimwiki_markdown.path_html = '~/vimwiki/markdown/html' +let vimwiki_markdown.syntax = 'markdown' +let vimwiki_markdown.ext = '.md' +let vimwiki_markdown.name = 'MarkdownSyntax' + +" mediawiki syntax - https://www.mediawiki.org/wiki/Help:Formatting +let vimwiki_mediawiki = {} +let vimwiki_mediawiki.path = '~/vimwiki_mediawiki' +let vimwiki_mediawiki.path_html = '~/vimwiki/mediawiki/html' +let vimwiki_mediawiki.syntax = 'mediawiki' +let vimwiki_mediawiki.ext = '.mw' +let vimwiki_mediawiki.name = 'MediaWikiSyntax' + +" register the 3 wikis +let g:vimwiki_list = [vimwiki_default, vimwiki_markdown, vimwiki_mediawiki]