diff options
author | w0rp <devw0rp@gmail.com> | 2023-09-10 17:44:25 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2023-09-10 17:44:25 +0100 |
commit | 1bf445c6d5c805db0e0733846538fa4bfd5d8a68 (patch) | |
tree | 3f95db076bdf2f4e1790f56b57a791138ab2086e /test/test_virtualtext.vader | |
parent | 385dc4130c8e8317638ba27f6d87b993de88c05c (diff) | |
download | ale-1bf445c6d5c805db0e0733846538fa4bfd5d8a68.zip |
Print the most severe problem with virtualtext
Fix the ordering of virtualtext so we print the most severe problem on a
line. If two problems are the most severe, we will print the left-most
problem.
Diffstat (limited to 'test/test_virtualtext.vader')
-rw-r--r-- | test/test_virtualtext.vader | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/test/test_virtualtext.vader b/test/test_virtualtext.vader index 25965f50..da58c9f0 100644 --- a/test/test_virtualtext.vader +++ b/test/test_virtualtext.vader @@ -37,6 +37,27 @@ Before: \ 'col': 5, \ 'text': 'Line 2 warning 2', \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'type': 'W', + \ 'lnum': 3, + \ 'col': 3, + \ 'text': 'Line 3 warning 1', + \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'type': 'E', + \ 'lnum': 3, + \ 'col': 5, + \ 'text': 'Line 3 error 1', + \ }, + \ { + \ 'bufnr': bufnr(''), + \ 'type': 'E', + \ 'lnum': 3, + \ 'col': 6, + \ 'text': 'Line 3 error 2', + \ }, \ ], \ }, \} @@ -79,6 +100,7 @@ Execute(Comment text should be detected correctly for HTML files): Given python(An example Python file): # line 1 # line 2 + # line 3 Execute(We should not show virtualtext when disabled): if has('patch-9.0.0297') || has('nvim-0.8.0') @@ -157,11 +179,11 @@ Execute(We should be able to change the virtualtext prefix per-buffer): AssertEqual 'B> Line 1 error', ale#virtualtext#GetLastMessageForTests() endif -Execute(We should set errors across all lines): +Execute(We should be able to set messages across all lines): if has('patch-9.0.0297') || has('nvim-0.8.0') call ale#virtualtext#SetTexts(bufnr(''), g:ale_buffer_info[bufnr('')].loclist) - AssertEqual '# W: Line 2 warning 2', ale#virtualtext#GetLastMessageForTests() + AssertEqual '# E: Line 3 error 2', ale#virtualtext#GetLastMessageForTests() if has('patch-9.0.0297') AssertEqual ['ALEVirtualTextError'], map(prop_list(1), {_, v -> v.type}) @@ -176,12 +198,12 @@ Execute(We should be able to limit virtual messages to the first one only): if has('patch-9.0.0297') || has('nvim-0.8.0') call ale#virtualtext#SetTexts(bufnr(''), g:ale_buffer_info[bufnr('')].loclist) - AssertEqual '# W: Line 2 warning 1', ale#virtualtext#GetLastMessageForTests() + AssertEqual '# E: Line 3 error 1', ale#virtualtext#GetLastMessageForTests() if has('patch-9.0.0297') AssertEqual ['ALEVirtualTextError'], map(prop_list(1), {_, v -> v.type}) - AssertEqual ['ALEVirtualTextWarning'], - \ map(prop_list(2), {_, v -> v.type}) + AssertEqual ['ALEVirtualTextWarning'], map(prop_list(2), {_, v -> v.type}) + AssertEqual ['ALEVirtualTextError'], map(prop_list(3), {_, v -> v.type}) endif endif |