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 endfunction
function! ale#balloon#Disable() abort function! ale#balloon#Disable() abort
if has('balloon_eval_term') if has('balloon_eval')
set noballoonevalterm set noballooneval
set balloonexpr=
endif endif
set noballooneval if has('balloon_eval_term')
set balloonexpr= set noballoonevalterm
set balloonexpr=
endif
endfunction endfunction
function! ale#balloon#Enable() abort function! ale#balloon#Enable() abort
if !has('balloon_eval') && !has('balloon_eval_term')
return
endif
if has('balloon_eval') if has('balloon_eval')
set ballooneval set ballooneval
set balloonexpr=ale#balloon#Expr()
endif endif
if has('balloon_eval_term') if has('balloon_eval_term')
set balloonevalterm set balloonevalterm
set balloonexpr=ale#balloon#Expr()
endif endif
set balloonexpr=ale#balloon#Expr()
endfunction endfunction

View file

@ -52,3 +52,26 @@ function! ale#test#SetFilename(path) abort
silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path)) silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path))
endfunction 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:CleanupEveryBuffer()
call s:DisablePostamble() call s:DisablePostamble()
if has('balloon_eval') if exists('*ale#balloon#Disable')
call ale#balloon#Disable() call ale#balloon#Disable()
endif endif
endif endif

View file

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

View file

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

View file

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

View file

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

View file

@ -68,7 +68,7 @@ Execute(tsserver syntax error responses should be handled correctly):
\ 'pattern': '', \ 'pattern': '',
\ }, \ },
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
" After we get empty syntax errors, we should clear them. " After we get empty syntax errors, we should clear them.
call ale#lsp_linter#HandleLSPResponse(1, { call ale#lsp_linter#HandleLSPResponse(1, {
@ -85,7 +85,7 @@ Execute(tsserver syntax error responses should be handled correctly):
AssertEqual AssertEqual
\ [ \ [
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
Execute(tsserver semantic error responses should be handled correctly): Execute(tsserver semantic error responses should be handled correctly):
runtime ale_linters/typescript/tsserver.vim runtime ale_linters/typescript/tsserver.vim
@ -141,7 +141,7 @@ Execute(tsserver semantic error responses should be handled correctly):
\ 'pattern': '', \ 'pattern': '',
\ }, \ },
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
" After we get empty syntax errors, we should clear them. " After we get empty syntax errors, we should clear them.
call ale#lsp_linter#HandleLSPResponse(1, { call ale#lsp_linter#HandleLSPResponse(1, {
@ -158,7 +158,7 @@ Execute(tsserver semantic error responses should be handled correctly):
AssertEqual AssertEqual
\ [ \ [
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
Execute(LSP errors should be logged in the history): Execute(LSP errors should be logged in the history):
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'}) 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) call ale#Queue(0)
sleep 1ms sleep 1ms
AssertEqual 1, len(getloclist(0)) AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
noautocmd let &filetype = 'foobar2' noautocmd let &filetype = 'foobar2'
@ -61,11 +61,11 @@ Execute(Error should be removed when the filetype changes to something else we c
sleep 1ms sleep 1ms
" We should get some items from the second filetype. " We should get some items from the second filetype.
AssertEqual 1, len(getloclist(0)) AssertEqual 1, len(ale#test#GetLoclistWithoutModule())
noautocmd let &filetype = 'xxx' noautocmd let &filetype = 'xxx'
call ale#Queue(0) call ale#Queue(0)
sleep 1ms sleep 1ms
AssertEqual 0, len(getloclist(0)) AssertEqual 0, len(ale#test#GetLoclistWithoutModule())

View file

@ -51,7 +51,7 @@ Before:
function! GetSimplerLoclist() function! GetSimplerLoclist()
let l:loclist = [] let l:loclist = []
for l:item in getloclist(0) for l:item in ale#test#GetLoclistWithoutModule()
call add(l:loclist, { call add(l:loclist, {
\ 'lnum': l:item.lnum, \ 'lnum': l:item.lnum,
\ 'col': l:item.col, \ '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, \ 'nr': -1,
\ 'pattern': '', \ 'pattern': '',
\ 'valid': 1, \ 'valid': 1,
\ }], getloclist(0) \ }], ale#test#GetLoclistWithoutModule()
Execute(The buffer should be checked after entering it after the file has changed): Execute(The buffer should be checked after entering it after the file has changed):
let b:ale_file_changed = 1 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, \ 'nr': -1,
\ 'pattern': '', \ 'pattern': '',
\ 'valid': 1, \ 'valid': 1,
\ }], getloclist(0) \ }], ale#test#GetLoclistWithoutModule()

View file

@ -53,7 +53,7 @@ Execute(Formatting with codes should work for the loclist):
\ 'text': 'nocode', \ 'text': 'nocode',
\ }, \ },
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
call remove(g:loclist, 0) call remove(g:loclist, 0)
call AddItem({'text': 'withcode', 'code': 'E123'}) call AddItem({'text': 'withcode', 'code': 'E123'})
@ -73,7 +73,7 @@ Execute(Formatting with codes should work for the loclist):
\ 'text': 'E123: withcode', \ 'text': 'E123: withcode',
\ }, \ },
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
Execute(Formatting with codes should work for the quickfix list): Execute(Formatting with codes should work for the quickfix list):
let g:ale_set_loclist = 0 let g:ale_set_loclist = 0
@ -96,7 +96,7 @@ Execute(Formatting with codes should work for the quickfix list):
\ 'text': 'nocode', \ 'text': 'nocode',
\ }, \ },
\ ], \ ],
\ getqflist() \ ale#test#GetQflistWithoutModule()
call remove(g:loclist, 0) call remove(g:loclist, 0)
call AddItem({'text': 'withcode', 'code': 'E123'}) call AddItem({'text': 'withcode', 'code': 'E123'})
@ -116,7 +116,7 @@ Execute(Formatting with codes should work for the quickfix list):
\ 'text': 'E123: withcode', \ 'text': 'E123: withcode',
\ }, \ },
\ ], \ ],
\ getqflist() \ ale#test#GetQflistWithoutModule()
Execute(Formatting with the linter name should work for the loclist): Execute(Formatting with the linter name should work for the loclist):
let g:ale_loclist_msg_format = '(%linter%) %s' 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', \ 'text': '(some_linter) whatever',
\ }, \ },
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()
Execute(Formatting with the linter name should work for the quickfix list): Execute(Formatting with the linter name should work for the quickfix list):
let g:ale_loclist_msg_format = '(%linter%) %s' 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', \ 'text': '(some_linter) whatever',
\ }, \ },
\ ], \ ],
\ getqflist() \ ale#test#GetQflistWithoutModule()
Execute(The buffer loclist format option should take precedence): Execute(The buffer loclist format option should take precedence):
let g:ale_loclist_msg_format = '(%linter%) %s' let g:ale_loclist_msg_format = '(%linter%) %s'
@ -185,4 +185,4 @@ Execute(The buffer loclist format option should take precedence):
\ 'text': 'FOO whatever', \ '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) 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): Execute(The quickfix window should be horizontal for the loclist with appropriate variables):
let g:ale_open_list = 1 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) 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): Execute(The quickfix window should stay open for just the loclist):
let g:ale_open_list = 1 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) 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): Execute(The quickfix window should be horizontal for the quickfix with appropriate variables):
let g:ale_open_list = 1 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) 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): Execute(The buffer ale_open_list option should be respected):
let b:ale_open_list = 1 let b:ale_open_list = 1

View file

@ -38,7 +38,7 @@ Execute(The loclist titles should be set appropriately):
\ 'nr': 0, \ 'nr': 0,
\ 'type': 'E', \ 'type': 'E',
\ 'pattern': '', \ 'pattern': '',
\}], getloclist(0) \}], ale#test#GetLoclistWithoutModule()
if !has('nvim') if !has('nvim')
AssertEqual AssertEqual
@ -68,7 +68,7 @@ Execute(The quickfix titles should be set appropriately):
\ 'nr': 0, \ 'nr': 0,
\ 'type': 'E', \ 'type': 'E',
\ 'pattern': '', \ 'pattern': '',
\}], getqflist() \}], ale#test#GetQflistWithoutModule()
if !has('nvim') if !has('nvim')
AssertEqual 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. " First try just the SaveEvent, to be sure that we set errors in the test.
call ale#events#SaveEvent(bufnr('')) 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. " Now try doing it again, but where we run the quit event first.
call setloclist(0, []) call setloclist(0, [])
call ale#events#QuitEvent(bufnr('')) call ale#events#QuitEvent(bufnr(''))
call ale#events#SaveEvent(bufnr('')) call ale#events#SaveEvent(bufnr(''))
AssertEqual [], getloclist(0) AssertEqual [], ale#test#GetLoclistWithoutModule()
Execute(No linting should be for :w after :q fails): Execute(No linting should be for :w after :q fails):
let g:ale_lint_on_save = 1 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('')) 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): Execute(No linting should be done on :wq or :x after fixing files):
let g:ale_lint_on_save = 0 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('')) 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. " Now try doing it again, but where we run the quit event first.
call setloclist(0, []) call setloclist(0, [])
call ale#events#QuitEvent(bufnr('')) call ale#events#QuitEvent(bufnr(''))
call ale#events#SaveEvent(bufnr('')) call ale#events#SaveEvent(bufnr(''))
AssertEqual [], getloclist(0) AssertEqual [], ale#test#GetLoclistWithoutModule()
Execute(Linting should be done after :q fails and fixing files): Execute(Linting should be done after :q fails and fixing files):
let g:ale_lint_on_save = 0 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('')) 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 :lopen
:q :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, \ 'nr': 0,
\ 'type': 'E', \ 'type': 'E',
\ 'pattern': '', \ '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, \ g:ale_buffer_info[(g:original_buffer)].loclist,
\ ) \ )
AssertEqual [], getloclist(0) AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual 1, len(getloclist(bufwinid(g:original_buffer))) AssertEqual 1, len(getloclist(bufwinid(g:original_buffer)))
AssertEqual 'foo', getloclist(bufwinid(g:original_buffer))[0].text 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': 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'}, \ {'lnum': 3, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'baz'},
\ ], \ ],
\ getloclist(0) \ ale#test#GetLoclistWithoutModule()