diff options
Diffstat (limited to 'test/test_balloon_messages.vader')
-rw-r--r-- | test/test_balloon_messages.vader | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/test/test_balloon_messages.vader b/test/test_balloon_messages.vader index ec09fe29..d0724c21 100644 --- a/test/test_balloon_messages.vader +++ b/test/test_balloon_messages.vader @@ -1,21 +1,34 @@ Before: Save g:ale_buffer_info + Save g:ale_enabled + Save g:ale_set_balloons - let g:ale_buffer_info[347] = {'loclist': [ + let g:ale_set_balloons = 1 + + let g:ale_buffer_info[bufnr('')] = {'loclist': [ + \ { + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'col': 10, + \ 'linter_name': 'eslint', + \ 'type': 'W', + \ 'text': 'Ignore me.', + \ }, \ { - \ 'bufnr': 347, + \ 'bufnr': bufnr(''), \ 'lnum': 1, \ 'col': 10, \ 'text': 'Missing semicolon. (semi)', + \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, + \ 'bufnr': bufnr(''), \ 'lnum': 2, \ 'col': 10, \ 'text': 'Infix operators must be spaced. (space-infix-ops)' \ }, \ { - \ 'bufnr': 347, + \ 'bufnr': bufnr(''), \ 'lnum': 2, \ 'col': 15, \ 'text': 'Missing radix parameter (radix)' @@ -25,17 +38,50 @@ Before: After: Restore + unlet! b:ale_enabled + unlet! b:ale_set_balloons + Execute(Balloon messages should be shown for the correct lines): AssertEqual \ 'Missing semicolon. (semi)', - \ ale#balloon#MessageForPos(347, 1, 1) + \ ale#balloon#MessageForPos(bufnr(''), 1, 1) Execute(Balloon messages should be shown for earlier columns): AssertEqual \ 'Infix operators must be spaced. (space-infix-ops)', - \ ale#balloon#MessageForPos(347, 2, 1) + \ ale#balloon#MessageForPos(bufnr(''), 2, 1) Execute(Balloon messages should be shown for later columns): AssertEqual \ 'Missing radix parameter (radix)', - \ ale#balloon#MessageForPos(347, 2, 16) + \ ale#balloon#MessageForPos(bufnr(''), 2, 16) + +Execute(Balloon messages should be disabled if ALE is disabled globally): + let g:ale_enabled = 0 + " Enabling the buffer should not make a difference. + let b:ale_enabled = 1 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if ALE is disabled for a buffer): + let b:ale_enabled = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if the global setting is off): + let g:ale_set_balloons = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(Balloon messages should be disabled if the buffer setting is off): + let b:ale_set_balloons = 0 + + AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1) + +Execute(The balloon buffer setting should override the global one): + let g:ale_set_balloons = 0 + let b:ale_set_balloons = 1 + + AssertEqual + \ 'Missing semicolon. (semi)', + \ ale#balloon#MessageForPos(bufnr(''), 1, 1) |