Intended to address #1267 - "get_diary_files() takes very long to execute on Windows - this leads to very slow link-creation using the Enter key". In theory, this should be a performance improvement for link creation on systems with very slow filesystem access (this came up under Windows, but ought to be a general optimization). It does nothing for generating the entire list of diary files, which by nature has to get the whole list anyway. - Uses a filereadable() call against a path instead of checking the results of get_diary_files() for most calls. - Introduces is_among_diary_files() for the case where you want to check against a get_diary_files() list. - is_diary_file() will pass through to is_among_diary_files() if it gets invoked with a second parameter, to retain backwards compatibility on the off chance anyone has scripted against this behavior. I'm not sure this is necessary, but trying to be cautious with the implicit API here. - Includes a test/api_base_is_diary_file.vader My original version of this change assumed that input would be in the form of "2023-01-01", instead of a fully-qualifed filename. As it is, it expects a full path to the file, in keeping with the list returned by vimwiki#diary#get_diary_files(). Bug: #1267
Vimwiki Tests
This directory contains a test framework used to automatically test/verify Vimwiki functionality. It is based on the following tools:
Resources
- Vim patches
- Example test cases:
Building Docker Image
To build the Docker image run docker build -t vimwiki . from the Vimwiki
repository root (same location as the Dockerfile).
Running Tests
Manual Steps
Starting in the test directory run this command:
docker run -it --rm -v $PWD/../:/testplugin -v $PWD/../test:/home vimwiki vim_7.4.1099 -u test/vimrc -i NONE
This will open a vim instance in the docker container and then all tests
can be run with :Vader test/* or individual tests can be run.
Note: Substitute vim_7.4.1099 for any of the vim versions in the Dockerfile.
Automated Tests
The script in the test/ directory named run_test.sh can be used to
automatically run all tests for all installed vim versions. The vim/nvim
versions are parsed from the Dockerfile. This script will also run Vint for all
plugin source files. For more information run ./run_tests.sh -h.
Writing Tests
You are advice to write tests at the top of the file where you want to include it because some Execute can have some side effect making it hard to debug
Inside the container
$USER->vimtest: unprivileged => very hard to mess up things$HOME->/home/vimtest: but it is readonly !$PWD->/testplugin: mapped to vimwiki plugin root directory
For more information, read the base docker image
Known Issues
- neovim v0.2.x does not work correctly with Vader output from the docker
container. No test results are printed and an error message saying
Vim: Error reading input, exiting...- Probably need to look into this more and determine if the issue is Vader, Neovim, or Docker.
- Vader does not play nice with the location list. Tests that use the location
list should be placed in
independent_runs/.
Notable Vim patches
v7.3.831getbufvaradded a default valuev7.4.236add ability to check patch with has("patch-7.4.123")v7.4.279added the option to forglobpath()to return a listv7.4.1546sticky type checking removed (allow a variables type to change)v7.4.1989filter()accepts a Funcrefv7.4.2044lambda support added - see:h expr-lambdav7.4.2120Added function "closure" argumentv7.4.2137addfuncref()v8.0async jobs and timers