commit 94d62ad7f2e76842dd6e97a25f0f93cce448af27
parent 0441be5e34841537756c15f1f81cf0b48123ca4c
Author: Rane Brown <rane.brown@gmail.com>
Date: Sun, 14 Jul 2019 07:32:38 -0600
Add vader tests and docker setup
Diffstat:
5 files changed, 108 insertions(+), 18 deletions(-)
diff --git a/Dockerfile 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
@@ -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
@@ -1,18 +0,0 @@
-" From https://github.com/vimwiki/vimwiki/pull/601
-$ gvim -u NONE -U NONE -N -i NONE
-<commands below can be copied to clipboard and run with `:@+`>
-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
@@ -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
@@ -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]