Get tests to pass in Vim 8.1

This commit is contained in:
w0rp 2018-07-23 20:41:06 +01:00
parent 11339ca730
commit d9579dbbe9
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
20 changed files with 150 additions and 104 deletions

View File

@ -34,26 +34,25 @@ function! ale#balloon#Expr() abort
endfunction
function! ale#balloon#Disable() abort
if has('balloon_eval_term')
set noballoonevalterm
if has('balloon_eval')
set noballooneval
set balloonexpr=
endif
set noballooneval
set balloonexpr=
if has('balloon_eval_term')
set noballoonevalterm
set balloonexpr=
endif
endfunction
function! ale#balloon#Enable() abort
if !has('balloon_eval') && !has('balloon_eval_term')
return
endif
if has('balloon_eval')
set ballooneval
set balloonexpr=ale#balloon#Expr()
endif
if has('balloon_eval_term')
set balloonevalterm
set balloonexpr=ale#balloon#Expr()
endif
set balloonexpr=ale#balloon#Expr()
endfunction

View File

@ -52,3 +52,26 @@ function! ale#test#SetFilename(path) abort
silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path))
endfunction
function! s:RemoveModule(results) abort
for l:item in a:results
if has_key(l:item, 'module')
call remove(l:item, 'module')
endif
endfor
endfunction
" Return loclist data without the module string, only in newer Vim versions.
function! ale#test#GetLoclistWithoutModule() abort
let l:results = getloclist(0)
call s:RemoveModule(l:results)
return l:results
endfunction
function! ale#test#GetQflistWithoutModule() abort
let l:results = getqflist()
call s:RemoveModule(l:results)
return l:results
endfunction

View File

@ -43,7 +43,7 @@ function! ale#toggle#Toggle() abort
call s:CleanupEveryBuffer()
call s:DisablePostamble()
if has('balloon_eval')
if exists('*ale#balloon#Disable')
call ale#balloon#Disable()
endif
endif

View File

@ -10,7 +10,7 @@ set -u
#
image=w0rp/ale
current_image_id=71553d0ab3e8
current_image_id=67896c9c2c0f
# Used in all test scripts for running the selected Docker image.
DOCKER_RUN_IMAGE="$image"
@ -22,7 +22,8 @@ verbose_flag=''
quiet_flag=''
run_neovim_02_tests=1
run_neovim_03_tests=1
run_vim_tests=1
run_vim_80_tests=1
run_vim_81_tests=1
run_linters=1
while [ $# -ne 0 ]; do
@ -36,19 +37,22 @@ while [ $# -ne 0 ]; do
shift
;;
--neovim-only)
run_vim_tests=0
run_vim_80_tests=0
run_vim_81_tests=0
run_linters=0
shift
;;
--neovim-02-only)
run_neovim_03_tests=0
run_vim_tests=0
run_vim_80_tests=0
run_vim_81_tests=0
run_linters=0
shift
;;
--neovim-03-only)
run_neovim_02_tests=0
run_vim_tests=0
run_vim_80_tests=0
run_vim_81_tests=0
run_linters=0
shift
;;
@ -58,8 +62,23 @@ while [ $# -ne 0 ]; do
run_linters=0
shift
;;
--vim-80-only)
run_neovim_02_tests=0
run_neovim_03_tests=0
run_vim_81_tests=0
run_linters=0
shift
;;
--vim-81-only)
run_neovim_02_tests=0
run_neovim_03_tests=0
run_vim_80_tests=0
run_linters=0
shift
;;
--linters-only)
run_vim_tests=0
run_vim_80_tests=0
run_vim_81_tests=0
run_neovim_02_tests=0
run_neovim_03_tests=0
shift
@ -76,7 +95,9 @@ while [ $# -ne 0 ]; do
echo ' --neovim-only Run tests only for NeoVim 0.2 and 0.3'
echo ' --neovim-02-only Run tests only for NeoVim 0.2'
echo ' --neovim-03-only Run tests only for NeoVim 0.3'
echo ' --vim-only Run tests only for Vim'
echo ' --vim-only Run tests only for Vim 8.0 and 8.1'
echo ' --vim-80-only Run tests only for Vim 8.0'
echo ' --vim-81-only Run tests only for Vim 8.1'
echo ' --linters-only Run only Vint and custom checks'
echo ' --help Show this help text'
echo ' -- Stop parsing options after this'
@ -120,12 +141,8 @@ file_number=0
pid_list=''
for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do
# Skip Vim 8.1 for now.
if [[ $vim =~ ^vim-v8.1 ]]; then
continue
fi
if ( [[ $vim =~ ^vim ]] && ((run_vim_tests)) ) \
if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \
|| ( [[ $vim =~ ^vim-v8.1 ]] && ((run_vim_81_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.2 ]] && ((run_neovim_02_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.3 ]] && ((run_neovim_03_tests)) ); then
echo "Starting Vim: $vim..."

View File

@ -458,7 +458,7 @@ Execute(ALEFix should save files on the save event):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], getloclist(0)
\}], ale#test#GetLoclistWithoutModule()
endif
Expect(The buffer should be modified):
@ -497,7 +497,7 @@ Execute(ALEFix should still lint with no linters to be applied):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], getloclist(0)
\}], ale#test#GetLoclistWithoutModule()
endif
Expect(The buffer should be the same):
@ -531,7 +531,7 @@ Execute(ALEFix should still lint when nothing was fixed on save):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], getloclist(0)
\}], ale#test#GetLoclistWithoutModule()
endif
Expect(The buffer should be the same):

View File

@ -35,7 +35,6 @@ After:
unlet! g:i
unlet! g:results
unlet! g:item
unlet! g:expected_results
delfunction TestCallback
@ -69,13 +68,7 @@ Execute(Linters should run with the default options):
call ale#Lint()
call ale#engine#WaitForJobs(2000)
let g:results = getloclist(0)
for g:item in g:results
if has_key(g:item, 'module')
call remove(g:item, 'module')
endif
endfor
let g:results = ale#test#GetLoclistWithoutModule()
if g:results == g:expected_results
break
@ -142,7 +135,7 @@ Execute(Linters should run in PowerShell too):
\ 'pattern': '',
\ 'valid': 1,
\ },
\], getloclist(0)
\], ale#test#GetLoclistWithoutModule()
endif
Execute(Previous errors should be removed when linters change):
@ -176,13 +169,7 @@ Execute(Previous errors should be removed when linters change):
call ale#Lint()
call ale#engine#WaitForJobs(2000)
let g:results = getloclist(0)
for g:item in g:results
if has_key(g:item, 'module')
call remove(g:item, 'module')
endif
endfor
let g:results = ale#test#GetLoclistWithoutModule()
if g:results == g:expected_results
break

View File

@ -66,10 +66,10 @@ Execute(ALELint should run the linters):
sleep 1ms
endif
if getloclist(0) == g:expected_loclist
if ale#test#GetLoclistWithoutModule() == g:expected_loclist
break
endif
endfor
" Check the loclist
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()

View File

@ -115,7 +115,7 @@ Execute(ALEToggle should reset everything and then run again):
ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -128,7 +128,7 @@ Execute(ALEToggle should reset everything and then run again):
" Everything should be cleared.
Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed'
AssertEqual [], getloclist(0), 'The loclist was not cleared'
AssertEqual [], ale#test#GetLoclistWithoutModule(), 'The loclist was not cleared'
AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
AssertEqual [], getmatches(), 'The highlights were not cleared'
AssertEqual g:expected_groups, ParseAuGroups()
@ -136,7 +136,7 @@ Execute(ALEToggle should reset everything and then run again):
" Toggle ALE on, everything should be set up and run again.
ALEToggle
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -189,16 +189,16 @@ Execute(ALEToggle should skip filename keys and preserve them):
Execute(ALEDisable should reset everything and stay disabled):
ALELint
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
ALEDisable
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 0, g:ale_enabled
ALEDisable
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 0, g:ale_enabled
Execute(ALEEnable should enable ALE and lint again):
@ -206,7 +206,7 @@ Execute(ALEEnable should enable ALE and lint again):
ALEEnable
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual 1, g:ale_enabled
Execute(ALEReset should reset everything for a buffer):
@ -215,7 +215,7 @@ Execute(ALEReset should reset everything for a buffer):
ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -227,7 +227,7 @@ Execute(ALEReset should reset everything for a buffer):
" Everything should be cleared.
Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed'
AssertEqual [], getloclist(0), 'The loclist was not cleared'
AssertEqual [], ale#test#GetLoclistWithoutModule(), 'The loclist was not cleared'
AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
AssertEqual [], getmatches(), 'The highlights were not cleared'
@ -239,7 +239,7 @@ Execute(ALEToggleBuffer should reset everything and then run again):
ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -251,14 +251,14 @@ Execute(ALEToggleBuffer should reset everything and then run again):
" Everything should be cleared.
Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed'
AssertEqual [], getloclist(0), 'The loclist was not cleared'
AssertEqual [], ale#test#GetLoclistWithoutModule(), 'The loclist was not cleared'
AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
AssertEqual [], getmatches(), 'The highlights were not cleared'
" Toggle ALE on, everything should be set up and run again.
ALEToggleBuffer
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -269,11 +269,11 @@ Execute(ALEToggleBuffer should reset everything and then run again):
Execute(ALEDisableBuffer should reset everything and stay disabled):
ALELint
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
ALEDisableBuffer
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 0, b:ale_enabled
Execute(ALEEnableBuffer should enable ALE and lint again):
@ -281,7 +281,7 @@ Execute(ALEEnableBuffer should enable ALE and lint again):
ALEEnableBuffer
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual 1, b:ale_enabled
Execute(ALEEnableBuffer should complain when ALE is disabled globally):
@ -292,7 +292,7 @@ Execute(ALEEnableBuffer should complain when ALE is disabled globally):
ALEEnableBuffer
redir END
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 0, b:ale_enabled
AssertEqual 0, g:ale_enabled
AssertEqual
@ -305,7 +305,7 @@ Execute(ALEResetBuffer should reset everything for a buffer):
ALELint
" First check that everything is there...
AssertEqual g:expected_loclist, getloclist(0)
AssertEqual g:expected_loclist, ale#test#GetLoclistWithoutModule()
AssertEqual [0, [[2, 1000001, 'ALEErrorSign']]], ale#sign#FindCurrentSigns(bufnr('%'))
AssertEqual
\ [{'group': 'ALEError', 'pos1': [2, 3, 1]}],
@ -317,7 +317,7 @@ Execute(ALEResetBuffer should reset everything for a buffer):
" Everything should be cleared.
Assert !has_key(g:ale_buffer_info, bufnr('')), 'The g:ale_buffer_info Dictionary was not removed'
AssertEqual [], getloclist(0), 'The loclist was not cleared'
AssertEqual [], ale#test#GetLoclistWithoutModule(), 'The loclist was not cleared'
AssertEqual [0, []], ale#sign#FindCurrentSigns(bufnr('%')), 'The signs were not cleared'
AssertEqual [], getmatches(), 'The highlights were not cleared'
@ -326,40 +326,60 @@ Execute(ALEResetBuffer should reset everything for a buffer):
Execute(Disabling ALE should disable balloons):
" These tests won't run in the console, but we can run them manually in GVim.
if has('balloon_eval') && has('gui_running') ||
\ has('balloon_eval_term') && !has('gui_running')
if has('balloon_eval') && has('gui_running')
\|| (has('balloon_eval_term') && !has('gui_running'))
call ale#linter#Reset()
" Enable balloons, so we can check the expr value.
call ale#balloon#Enable()
AssertEqual 1, &ballooneval
if has('balloon_eval') && has('gui_running')
AssertEqual 1, &ballooneval
else
AssertEqual 1, &balloonevalterm
endif
AssertEqual 'ale#balloon#Expr()', &balloonexpr
" Toggle ALE off.
ALEToggle
" The balloon settings should be reset.
AssertEqual 0, &ballooneval
if has('balloon_eval') && has('gui_running')
AssertEqual 0, &ballooneval
else
AssertEqual 0, &balloonevalterm
endif
AssertEqual '', &balloonexpr
endif
Execute(Enabling ALE should enable balloons if the setting is on):
if has('balloon_eval') && has('gui_running') ||
\ has('balloon_eval_term') && !has('gui_running')
if has('balloon_eval') && has('gui_running')
\|| (has('balloon_eval_term') && !has('gui_running'))
call ale#linter#Reset()
call ale#balloon#Disable()
ALEDisable
let g:ale_set_balloons = 0
ALEEnable
AssertEqual 0, &ballooneval
if has('balloon_eval') && has('gui_running')
AssertEqual 0, &ballooneval
else
AssertEqual 0, &balloonevalterm
endif
AssertEqual '', &balloonexpr
ALEDisable
let g:ale_set_balloons = 1
ALEEnable
AssertEqual 1, &ballooneval
if has('balloon_eval') && has('gui_running')
AssertEqual 1, &ballooneval
else
AssertEqual 1, &balloonevalterm
endif
AssertEqual 'ale#balloon#Expr()', &balloonexpr
endif

View File

@ -68,7 +68,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'pattern': '',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
" After we get empty syntax errors, we should clear them.
call ale#lsp_linter#HandleLSPResponse(1, {
@ -85,7 +85,7 @@ Execute(tsserver syntax error responses should be handled correctly):
AssertEqual
\ [
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
Execute(tsserver semantic error responses should be handled correctly):
runtime ale_linters/typescript/tsserver.vim
@ -141,7 +141,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'pattern': '',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
" After we get empty syntax errors, we should clear them.
call ale#lsp_linter#HandleLSPResponse(1, {
@ -158,7 +158,7 @@ Execute(tsserver semantic error responses should be handled correctly):
AssertEqual
\ [
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
Execute(LSP errors should be logged in the history):
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'})

View File

@ -53,7 +53,7 @@ Execute(Error should be removed when the filetype changes to something else we c
call ale#Queue(0)
sleep 1ms
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
noautocmd let &filetype = 'foobar2'
@ -61,11 +61,11 @@ Execute(Error should be removed when the filetype changes to something else we c
sleep 1ms
" We should get some items from the second filetype.
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
noautocmd let &filetype = 'xxx'
call ale#Queue(0)
sleep 1ms
AssertEqual 0, len(getloclist(0))
AssertEqual 0, len(ale#test#GetLoclistWithoutModule())

View File

@ -51,7 +51,7 @@ Before:
function! GetSimplerLoclist()
let l:loclist = []
for l:item in getloclist(0)
for l:item in ale#test#GetLoclistWithoutModule()
call add(l:loclist, {
\ 'lnum': l:item.lnum,
\ 'col': l:item.col,

View File

@ -61,7 +61,7 @@ Execute(The file changed event function should lint the current buffer when it h
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\ }], getloclist(0)
\ }], ale#test#GetLoclistWithoutModule()
Execute(The buffer should be checked after entering it after the file has changed):
let b:ale_file_changed = 1
@ -79,4 +79,4 @@ Execute(The buffer should be checked after entering it after the file has change
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\ }], getloclist(0)
\ }], ale#test#GetLoclistWithoutModule()

View File

@ -53,7 +53,7 @@ Execute(Formatting with codes should work for the loclist):
\ 'text': 'nocode',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
call remove(g:loclist, 0)
call AddItem({'text': 'withcode', 'code': 'E123'})
@ -73,7 +73,7 @@ Execute(Formatting with codes should work for the loclist):
\ 'text': 'E123: withcode',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
Execute(Formatting with codes should work for the quickfix list):
let g:ale_set_loclist = 0
@ -96,7 +96,7 @@ Execute(Formatting with codes should work for the quickfix list):
\ 'text': 'nocode',
\ },
\ ],
\ getqflist()
\ ale#test#GetQflistWithoutModule()
call remove(g:loclist, 0)
call AddItem({'text': 'withcode', 'code': 'E123'})
@ -116,7 +116,7 @@ Execute(Formatting with codes should work for the quickfix list):
\ 'text': 'E123: withcode',
\ },
\ ],
\ getqflist()
\ ale#test#GetQflistWithoutModule()
Execute(Formatting with the linter name should work for the loclist):
let g:ale_loclist_msg_format = '(%linter%) %s'
@ -138,7 +138,7 @@ Execute(Formatting with the linter name should work for the loclist):
\ 'text': '(some_linter) whatever',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()
Execute(Formatting with the linter name should work for the quickfix list):
let g:ale_loclist_msg_format = '(%linter%) %s'
@ -162,7 +162,7 @@ Execute(Formatting with the linter name should work for the quickfix list):
\ 'text': '(some_linter) whatever',
\ },
\ ],
\ getqflist()
\ ale#test#GetQflistWithoutModule()
Execute(The buffer loclist format option should take precedence):
let g:ale_loclist_msg_format = '(%linter%) %s'
@ -185,4 +185,4 @@ Execute(The buffer loclist format option should take precedence):
\ 'text': 'FOO whatever',
\ },
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()

View File

@ -120,7 +120,7 @@ Execute(The quickfix window should be vertical for the loclist with appropriate
call ale#list#SetLists(bufnr('%'), g:loclist)
AssertEqual 1, GetQuickfixIsVertical(b:ale_list_window_size)
AssertEqual 1, GetQuickfixIsVertical(8)
Execute(The quickfix window should be horizontal for the loclist with appropriate variables):
let g:ale_open_list = 1
@ -129,7 +129,7 @@ Execute(The quickfix window should be horizontal for the loclist with appropriat
call ale#list#SetLists(bufnr('%'), g:loclist)
AssertEqual 0, GetQuickfixIsVertical(b:ale_list_window_size)
AssertEqual 0, GetQuickfixIsVertical(8)
Execute(The quickfix window should stay open for just the loclist):
let g:ale_open_list = 1
@ -207,7 +207,7 @@ Execute(The quickfix window should be vertical for the quickfix with appropriate
call ale#list#SetLists(bufnr('%'), g:loclist)
AssertEqual 1, GetQuickfixIsVertical(b:ale_list_window_size)
AssertEqual 1, GetQuickfixIsVertical(8)
Execute(The quickfix window should be horizontal for the quickfix with appropriate variables):
let g:ale_open_list = 1
@ -216,7 +216,7 @@ Execute(The quickfix window should be horizontal for the quickfix with appropria
call ale#list#SetLists(bufnr('%'), g:loclist)
AssertEqual 0, GetQuickfixIsVertical(b:ale_list_window_size)
AssertEqual 0, GetQuickfixIsVertical(8)
Execute(The buffer ale_open_list option should be respected):
let b:ale_open_list = 1

View File

@ -38,7 +38,7 @@ Execute(The loclist titles should be set appropriately):
\ 'nr': 0,
\ 'type': 'E',
\ 'pattern': '',
\}], getloclist(0)
\}], ale#test#GetLoclistWithoutModule()
if !has('nvim')
AssertEqual
@ -68,7 +68,7 @@ Execute(The quickfix titles should be set appropriately):
\ 'nr': 0,
\ 'type': 'E',
\ 'pattern': '',
\}], getqflist()
\}], ale#test#GetQflistWithoutModule()
if !has('nvim')
AssertEqual

View File

@ -59,14 +59,14 @@ Execute(No linting should be done on :wq or :x):
" First try just the SaveEvent, to be sure that we set errors in the test.
call ale#events#SaveEvent(bufnr(''))
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
" Now try doing it again, but where we run the quit event first.
call setloclist(0, [])
call ale#events#QuitEvent(bufnr(''))
call ale#events#SaveEvent(bufnr(''))
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
Execute(No linting should be for :w after :q fails):
let g:ale_lint_on_save = 1
@ -79,7 +79,7 @@ Execute(No linting should be for :w after :q fails):
call ale#events#SaveEvent(bufnr(''))
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
Execute(No linting should be done on :wq or :x after fixing files):
let g:ale_lint_on_save = 0
@ -87,14 +87,14 @@ Execute(No linting should be done on :wq or :x after fixing files):
call ale#events#SaveEvent(bufnr(''))
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
" Now try doing it again, but where we run the quit event first.
call setloclist(0, [])
call ale#events#QuitEvent(bufnr(''))
call ale#events#SaveEvent(bufnr(''))
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
Execute(Linting should be done after :q fails and fixing files):
let g:ale_lint_on_save = 0
@ -107,4 +107,4 @@ Execute(Linting should be done after :q fails and fixing files):
call ale#events#SaveEvent(bufnr(''))
AssertEqual 1, len(getloclist(0))
AssertEqual 1, len(ale#test#GetLoclistWithoutModule())

View File

@ -27,4 +27,4 @@ Execute(The loclist shouldn't be cleared when opening the loclist):
:lopen
:q
AssertEqual 1, len(getloclist(0)), 'The loclist was cleared'
AssertEqual 1, len(ale#test#GetLoclistWithoutModule()), 'The loclist was cleared'

View File

@ -26,4 +26,4 @@ Execute(The SetLists function should work when run in a timer):
\ 'nr': 0,
\ 'type': 'E',
\ 'pattern': '',
\}], getloclist(0)
\}], ale#test#GetLoclistWithoutModule()

View File

@ -21,6 +21,6 @@ Execute(Errors should be set in the loclist for the original buffer, not the new
\ g:ale_buffer_info[(g:original_buffer)].loclist,
\ )
AssertEqual [], getloclist(0)
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 1, len(getloclist(bufwinid(g:original_buffer)))
AssertEqual 'foo', getloclist(bufwinid(g:original_buffer))[0].text

View File

@ -95,4 +95,4 @@ Execute(Problems found from previously opened buffers should be set when linting
\ {'lnum': 2, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'bar'},
\ {'lnum': 3, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'baz'},
\ ],
\ getloclist(0)
\ ale#test#GetLoclistWithoutModule()