summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--autoload/ale/balloon.vim6
-rwxr-xr-xrun-tests48
-rwxr-xr-xtest/script/custom-checks3
-rwxr-xr-xtest/script/run-vader-tests3
-rwxr-xr-xtest/script/run-vint3
-rw-r--r--test/sign/test_linting_sets_signs.vader1
-rw-r--r--test/sign/test_sign_placement.vader18
-rw-r--r--test/smoke_test.vader1
-rw-r--r--test/test_ale_lint_command.vader4
-rw-r--r--test/test_ale_toggle.vader29
-rw-r--r--test/test_format_temporary_file_creation.vader2
-rw-r--r--test/test_history_saving.vader5
-rw-r--r--test/test_lint_file_linters.vader2
-rw-r--r--test/test_linting_blacklist.vader2
-rw-r--r--test/test_linting_updates_loclist.vader78
16 files changed, 131 insertions, 76 deletions
diff --git a/Dockerfile b/Dockerfile
index 0f82c4a2..20a43bca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
FROM tweekmonster/vim-testbed:latest
RUN install_vim -tag v8.0.0027 -build \
- -tag neovim:v0.2.1 -build \
+ -tag neovim:v0.2.0 -build \
-tag neovim:v0.3.0 -build
ENV PACKAGES="\
diff --git a/autoload/ale/balloon.vim b/autoload/ale/balloon.vim
index d49dcbf9..7a380da2 100644
--- a/autoload/ale/balloon.vim
+++ b/autoload/ale/balloon.vim
@@ -34,7 +34,11 @@ function! ale#balloon#Expr() abort
endfunction
function! ale#balloon#Disable() abort
- set noballooneval noballoonevalterm
+ if has('balloon_eval_term')
+ set noballoonevalterm
+ endif
+
+ set noballooneval
set balloonexpr=
endfunction
diff --git a/run-tests b/run-tests
index c228f15d..59558d4f 100755
--- a/run-tests
+++ b/run-tests
@@ -12,14 +12,20 @@ set -u
# --neovim-only Run tests only for NeoVim
# --vim-only Run tests only for Vim
-current_image_id=d5a1b5915b09
image=w0rp/ale
+current_image_id=13b990377be9
+current_digest=sha256:4b0f7c69e5a8cbb4e401aee039e5b468d6d9ad6cd01de62e918d98f0df1a5340
+
+# Used in all test scripts for running the selected Docker image.
+DOCKER_RUN_IMAGE="$image:$current_image_id"
+export DOCKER_RUN_IMAGE
tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader'
# These flags are forwarded to the script for running Vader tests.
verbose_flag=''
quiet_flag=''
-run_neovim_tests=1
+run_neovim_02_tests=1
+run_neovim_03_tests=1
run_vim_tests=1
run_vint=1
run_custom_checks=1
@@ -40,8 +46,23 @@ while [ $# -ne 0 ]; do
run_custom_checks=0
shift
;;
+ --neovim-02-only)
+ run_neovim_03_tests=0
+ run_vim_tests=0
+ run_vint=0
+ run_custom_checks=0
+ shift
+ ;;
+ --neovim-03-only)
+ run_neovim_02_tests=0
+ run_vim_tests=0
+ run_vint=0
+ run_custom_checks=0
+ shift
+ ;;
--vim-only)
- run_neovim_tests=0
+ run_neovim_02_tests=0
+ run_neovim_03_tests=0
run_vint=0
run_custom_checks=0
shift
@@ -52,7 +73,8 @@ while [ $# -ne 0 ]; do
;;
--vint-only)
run_vim_tests=0
- run_neovim_tests=0
+ run_neovim_02_tests=0
+ run_neovim_03_tests=0
run_custom_checks=0
shift
;;
@@ -62,7 +84,8 @@ while [ $# -ne 0 ]; do
;;
--custom-checks-only)
run_vim_tests=0
- run_neovim_tests=0
+ run_neovim_02_tests=0
+ run_neovim_03_tests=0
run_vint=0
shift
;;
@@ -90,8 +113,7 @@ fi
# Delete .swp files in the test directory, which cause Vim 8 to hang.
find test -name '*.swp' -delete
-docker images -q w0rp/ale | grep "^$current_image_id" > /dev/null \
- || docker pull "$image"
+docker pull "$image"@"$current_digest"
output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
@@ -100,8 +122,10 @@ trap '{ rm -rf "$output_dir"; }' EXIT
file_number=0
pid_list=''
-for vim in $(docker run --rm "$image" ls /vim-build/bin | grep '^neovim\|^vim' ); do
- if ((run_vim_tests)) || [[ $vim =~ ^neovim ]] && ((run_neovim_tests)); then
+for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do
+ if ( [[ $vim =~ ^vim ]] && ((run_vim_tests)) ) \
+ || ( [[ $vim =~ ^neovim-v0.2 ]] && ((run_neovim_02_tests)) ) \
+ || ( [[ $vim =~ ^neovim-v0.3 ]] && ((run_neovim_03_tests)) ); then
echo "Starting Vim: $vim..."
file_number=$((file_number+1))
test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \
@@ -139,4 +163,10 @@ for pid in $pid_list; do
cat "$output_dir/$index"
done
+if ((failed)); then
+ echo 'Something went wrong!'
+else
+ echo 'All tests passed!'
+fi
+
exit $failed
diff --git a/test/script/custom-checks b/test/script/custom-checks
index 76b9bc86..d4027fec 100755
--- a/test/script/custom-checks
+++ b/test/script/custom-checks
@@ -4,8 +4,7 @@ set -e
set -u
exit_code=0
-image=w0rp/ale
-docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$image")
+docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE")
echo '========================================'
echo 'Running custom linting rules'
diff --git a/test/script/run-vader-tests b/test/script/run-vader-tests
index 3e7e815c..e952faf0 100755
--- a/test/script/run-vader-tests
+++ b/test/script/run-vader-tests
@@ -3,8 +3,7 @@
set -e
set -u
-image=w0rp/ale
-docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$image")
+docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE")
red='\033[0;31m'
green='\033[0;32m'
nc='\033[0m'
diff --git a/test/script/run-vint b/test/script/run-vint
index 0d5b6e11..ce42ad41 100755
--- a/test/script/run-vint
+++ b/test/script/run-vint
@@ -4,8 +4,7 @@ set -e
set -u
exit_code=0
-image=w0rp/ale
-docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$image")
+docker_flags=(--rm -v "$PWD:/testplugin" -v "$PWD/test:/home" -w /testplugin "$DOCKER_RUN_IMAGE")
echo '========================================'
echo 'Running Vint to lint our code'
diff --git a/test/sign/test_linting_sets_signs.vader b/test/sign/test_linting_sets_signs.vader
index c23b4002..2f9be7b2 100644
--- a/test/sign/test_linting_sets_signs.vader
+++ b/test/sign/test_linting_sets_signs.vader
@@ -44,6 +44,7 @@ After:
sign unplace *
let g:ale_buffer_info = {}
+ call ale#engine#Cleanup(bufnr(''))
call ale#linter#Reset()
Execute(The signs should be updated after linting is done):
diff --git a/test/sign/test_sign_placement.vader b/test/sign/test_sign_placement.vader
index 19267fe7..e2d95ff0 100644
--- a/test/sign/test_sign_placement.vader
+++ b/test/sign/test_sign_placement.vader
@@ -1,9 +1,20 @@
Before:
- Save g:ale_set_signs
Save g:ale_buffer_info
+ Save g:ale_echo_cursor
+ Save g:ale_run_synchronously
+ Save g:ale_set_highlights
+ Save g:ale_set_loclist
+ Save g:ale_set_quickfix
+ Save g:ale_set_signs
- let g:ale_set_signs = 1
let g:ale_buffer_info = {}
+ let g:ale_run_synchronously = 1
+ let g:ale_set_signs = 1
+ " Disable features we don't need for these tests.
+ let g:ale_set_quickfix = 0
+ let g:ale_set_loclist = 0
+ let g:ale_set_highlights = 0
+ let g:ale_echo_cursor = 0
call ale#linter#Reset()
sign unplace *
@@ -122,8 +133,7 @@ Given testft(A file with warnings/errors):
fifth line
Execute(The current signs should be set for running a job):
- call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ ALELint
AssertEqual
\ [
diff --git a/test/smoke_test.vader b/test/smoke_test.vader
index 843bddab..7f9dfd03 100644
--- a/test/smoke_test.vader
+++ b/test/smoke_test.vader
@@ -35,6 +35,7 @@ After:
delfunction TestCallback
delfunction TestCallback2
+ call ale#engine#Cleanup(bufnr(''))
call ale#linter#Reset()
Given foobar (Some imaginary filetype):
diff --git a/test/test_ale_lint_command.vader b/test/test_ale_lint_command.vader
index 7b4f7613..15f1f054 100644
--- a/test/test_ale_lint_command.vader
+++ b/test/test_ale_lint_command.vader
@@ -39,9 +39,11 @@ After:
unlet! g:expected_loclist
- let g:ale_buffer_info = {}
+ call ale#engine#Cleanup(bufnr(''))
call ale#linter#Reset()
+ let g:ale_buffer_info = {}
+
delfunction ToggleTestCallback
Given foobar (Some imaginary filetype):
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index cac762b4..3b3c509c 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -110,13 +110,9 @@ Given foobar (Some imaginary filetype):
baz
Execute(ALEToggle should reset everything and then run again):
- " Run this test asynchrously.
- let g:ale_run_synchronously = 0
-
AssertEqual 'foobar', &filetype
- call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
@@ -139,7 +135,6 @@ Execute(ALEToggle should reset everything and then run again):
" Toggle ALE on, everything should be set up and run again.
ALEToggle
- call ale#engine#WaitForJobs(2000)
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
@@ -150,9 +145,6 @@ Execute(ALEToggle should reset everything and then run again):
AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist
Execute(ALEToggle should skip filename keys and preserve them):
- " Run this test asynchrously.
- let g:ale_run_synchronously = 0
-
AssertEqual 'foobar', &filetype
let g:ale_buffer_info['/foo/bar/baz.txt'] = {
@@ -164,8 +156,7 @@ Execute(ALEToggle should skip filename keys and preserve them):
\ 'history': [],
\}
- call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ ALELint
" Now Toggle ALE off.
ALEToggle
@@ -183,7 +174,6 @@ Execute(ALEToggle should skip filename keys and preserve them):
" Toggle ALE on again.
ALEToggle
- call ale#engine#WaitForJobs(2000)
AssertEqual
\ {
@@ -197,7 +187,7 @@ Execute(ALEToggle should skip filename keys and preserve them):
\ get(g:ale_buffer_info, '/foo/bar/baz.txt', {})
Execute(ALEDisable should reset everything and stay disabled):
- call ale#Lint()
+ ALELint
AssertEqual g:expected_loclist, getloclist(0)
@@ -222,7 +212,7 @@ Execute(ALEEnable should enable ALE and lint again):
Execute(ALEReset should reset everything for a buffer):
AssertEqual 'foobar', &filetype
- call ale#Lint()
+ ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
@@ -244,13 +234,9 @@ Execute(ALEReset should reset everything for a buffer):
AssertEqual 1, g:ale_enabled
Execute(ALEToggleBuffer should reset everything and then run again):
- " Run this test asynchrously.
- let g:ale_run_synchronously = 0
-
AssertEqual 'foobar', &filetype
- call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
@@ -271,7 +257,6 @@ Execute(ALEToggleBuffer should reset everything and then run again):
" Toggle ALE on, everything should be set up and run again.
ALEToggleBuffer
- call ale#engine#WaitForJobs(2000)
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
@@ -282,7 +267,7 @@ Execute(ALEToggleBuffer should reset everything and then run again):
AssertEqual [{'lnum': 2, 'bufnr': bufnr(''), 'col': 3, 'linter_name': 'testlinter', 'vcol': 0, 'nr': -1, 'type': 'E', 'text': 'foo bar', 'sign_id': 1000001}], g:ale_buffer_info[bufnr('')].loclist
Execute(ALEDisableBuffer should reset everything and stay disabled):
- call ale#Lint()
+ ALELint
AssertEqual g:expected_loclist, getloclist(0)
@@ -317,7 +302,7 @@ Execute(ALEEnableBuffer should complain when ALE is disabled globally):
Execute(ALEResetBuffer should reset everything for a buffer):
AssertEqual 'foobar', &filetype
- call ale#Lint()
+ ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
diff --git a/test/test_format_temporary_file_creation.vader b/test/test_format_temporary_file_creation.vader
index 1afaba30..fc43e2a1 100644
--- a/test/test_format_temporary_file_creation.vader
+++ b/test/test_format_temporary_file_creation.vader
@@ -17,6 +17,8 @@ Before:
After:
unlet! g:output
delfunction TestCallback
+
+ call ale#engine#Cleanup(bufnr(''))
call ale#linter#Reset()
Given foobar (Some imaginary filetype):
diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader
index 7dabcd9d..8764b74c 100644
--- a/test/test_history_saving.vader
+++ b/test/test_history_saving.vader
@@ -52,9 +52,12 @@ After:
let g:ale_history_enabled = 1
let g:ale_history_log_output = 0
unlet g:history
+
+ call ale#engine#Cleanup(bufnr(''))
+ call ale#linter#Reset()
+
let g:ale_buffer_info = {}
let g:ale_max_buffer_history_size = 20
- call ale#linter#Reset()
delfunction TestFixer
delfunction CollectResults
diff --git a/test/test_lint_file_linters.vader b/test/test_lint_file_linters.vader
index 2e992e13..14339e21 100644
--- a/test/test_lint_file_linters.vader
+++ b/test/test_lint_file_linters.vader
@@ -85,7 +85,7 @@ Before:
After:
if !g:ale_run_synchronously
- call ale#engine#WaitForJobs(2000)
+ call ale#engine#Cleanup(bufnr(''))
endif
Restore
diff --git a/test/test_linting_blacklist.vader b/test/test_linting_blacklist.vader
index 9960264d..2d9ed585 100644
--- a/test/test_linting_blacklist.vader
+++ b/test/test_linting_blacklist.vader
@@ -2,6 +2,8 @@ Before:
let g:ale_buffer_info = {}
After:
+ call ale#engine#Cleanup(bufnr(''))
+
let g:ale_buffer_info = {}
Given unite (A Unite.vim file):
diff --git a/test/test_linting_updates_loclist.vader b/test/test_linting_updates_loclist.vader
index 29ca05d4..921cdb08 100644
--- a/test/test_linting_updates_loclist.vader
+++ b/test/test_linting_updates_loclist.vader
@@ -1,31 +1,24 @@
Before:
+ Save g:ale_echo_cursor
+ Save g:ale_set_highlights
+ Save g:ale_set_loclist
+ Save g:ale_set_quickfix
Save g:ale_set_signs
+ Save g:ale_run_synchronously
+ Save g:ale_set_lists_synchronously
+ Save g:ale_buffer_info
+
+ " We want to check that sign IDs are set for this test.
let g:ale_set_signs = 1
+ let g:ale_set_loclist = 1
+ " Disable features we don't need for these tests.
+ let g:ale_set_quickfix = 0
+ let g:ale_set_highlights = 0
+ let g:ale_echo_cursor = 0
- let g:expected_data = [
- \ {
- \ 'lnum': 1,
- \ 'bufnr': bufnr('%'),
- \ 'vcol': 0,
- \ 'linter_name': 'testlinter',
- \ 'nr': -1,
- \ 'type': 'W',
- \ 'col': 10,
- \ 'text': 'Infix operators must be spaced. [Warning/space-infix-ops]',
- \ 'sign_id': 1000001,
- \ },
- \ {
- \ 'lnum': 2,
- \ 'bufnr': bufnr('%'),
- \ 'vcol': 0,
- \ 'linter_name': 'testlinter',
- \ 'nr': -1,
- \ 'type': 'E',
- \ 'col': 10,
- \ 'text': 'Missing semicolon. [Error/semi]',
- \ 'sign_id': 1000002,
- \ }
- \]
+ let g:ale_run_synchronously = 1
+ let g:ale_set_lists_synchronously = 1
+ let g:ale_buffer_info = {}
function! TestCallback(buffer, output)
return [
@@ -54,22 +47,47 @@ Before:
sign unplace *
+ call ale#engine#Cleanup(bufnr(''))
+
After:
Restore
delfunction TestCallback
- unlet! g:expected_data
- let g:ale_buffer_info = {}
call ale#linter#Reset()
+ sign unplace *
+
Given foobar (Some JavaScript with problems):
var y = 3+3;
var y = 3
Execute(The loclist should be updated after linting is done):
- call ale#Lint()
- call ale#engine#WaitForJobs(2000)
+ ALELint
- AssertEqual ['' . bufnr('%')], keys(g:ale_buffer_info)
- AssertEqual g:expected_data, g:ale_buffer_info[bufnr('%')].loclist
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'linter_name': 'testlinter',
+ \ 'nr': -1,
+ \ 'type': 'W',
+ \ 'col': 10,
+ \ 'text': 'Infix operators must be spaced. [Warning/space-infix-ops]',
+ \ 'sign_id': 1000001,
+ \ },
+ \ {
+ \ 'lnum': 2,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'linter_name': 'testlinter',
+ \ 'nr': -1,
+ \ 'type': 'E',
+ \ 'col': 10,
+ \ 'text': 'Missing semicolon. [Error/semi]',
+ \ 'sign_id': 1000002,
+ \ }
+ \ ],
+ \ get(get(g:ale_buffer_info, bufnr('%'), {}), 'loclist', [])