diff options
author | w0rp <devw0rp@gmail.com> | 2018-04-12 20:31:33 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-04-12 20:31:45 +0100 |
commit | 0cd8e8630b69613df3a2a65fdd830364de157129 (patch) | |
tree | 43f28b61ee1893537999007e0cb5df6a0708992b /test | |
parent | 3401a4e8ea35608d90a6cf709a790a37f112d201 (diff) | |
download | ale-0cd8e8630b69613df3a2a65fdd830364de157129.zip |
#1497 Tolerate important ALE variables being undefined for some reason when viewing buffers like git commits
Diffstat (limited to 'test')
-rw-r--r-- | test/test_lint_error_delay.vader | 10 | ||||
-rw-r--r-- | test/test_should_do_nothing_conditions.vader | 15 |
2 files changed, 19 insertions, 6 deletions
diff --git a/test/test_lint_error_delay.vader b/test/test_lint_error_delay.vader index 7f081794..05664899 100644 --- a/test/test_lint_error_delay.vader +++ b/test/test_lint_error_delay.vader @@ -1,11 +1,13 @@ Before: - Save g:ale_filetype_blacklist + runtime autoload/ale.vim - " Delete some variable which should be defined. - unlet! g:ale_filetype_blacklist + " Replace one of the key ALE functions and make it throw. + function! ale#FileTooLarge() abort + throw 'broken' + endfunction After: - Restore + runtime autoload/ale.vim call ale#ResetErrorDelays() diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader index 23ebd92e..85874e53 100644 --- a/test/test_should_do_nothing_conditions.vader +++ b/test/test_should_do_nothing_conditions.vader @@ -1,4 +1,7 @@ Before: + Save g:ale_filetype_blacklist + Save g:ale_maximum_file_size + Save g:ale_enabled Save &l:statusline call ale#test#SetDirectory('/testplugin/test') @@ -12,6 +15,8 @@ Before: endif After: + Restore + call ale#test#RestoreDirectory() if b:funky_command_created @@ -21,8 +26,6 @@ After: unlet! b:funky_command_created - Restore - Execute(ALE shouldn't do much of anything for ctrlp-funky buffers): Assert !ale#ShouldDoNothing(bufnr('')), 'The preliminary check failed' @@ -39,3 +42,11 @@ Execute(ALE shouldn't try to check buffers with '.' as the filename): silent! noautocmd file . Assert ale#ShouldDoNothing(bufnr('')) + +Execute(The DoNothing check should work if the ALE globals aren't defined): + unlet! g:ale_filetype_blacklist + unlet! g:ale_maximum_file_size + unlet! g:ale_enabled + + " This shouldn't throw exceptions. + call ale#ShouldDoNothing(bufnr('')) |