summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-19 20:15:36 +0100
committerw0rp <devw0rp@gmail.com>2017-08-19 20:15:46 +0100
commit9d6883561c9ea04a8552904eda518e49670fa7cb (patch)
treefd01b9b86e60cc45a4b6d4f9a139cb88d8fcfc63 /test
parentb2d3764a18d410820b3623067067cd10f5f7f076 (diff)
downloadale-9d6883561c9ea04a8552904eda518e49670fa7cb.zip
#653 Set problems from other buffers when buffers are first checked
Diffstat (limited to 'test')
-rw-r--r--test/test_setting_problems_found_in_previous_buffers.vader60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/test_setting_problems_found_in_previous_buffers.vader b/test/test_setting_problems_found_in_previous_buffers.vader
new file mode 100644
index 00000000..262b9d18
--- /dev/null
+++ b/test/test_setting_problems_found_in_previous_buffers.vader
@@ -0,0 +1,60 @@
+Before:
+ Save g:ale_buffer_info
+ Save &filetype
+
+ " Set up items in other buffers which should set in this one.
+ let g:ale_buffer_info = {}
+ call ale#engine#InitBufferInfo(bufnr('') + 1)
+ let g:ale_buffer_info[bufnr('') + 1].loclist =
+ \ ale#engine#FixLocList(bufnr('') + 1, 'linter_one', [
+ \ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
+ \ {'lnum': 2, 'filename': expand('%:p'), 'text': 'bar'},
+ \ {'lnum': 2, 'text': 'ignore this one'},
+ \ ])
+ call ale#engine#InitBufferInfo(bufnr('') + 2)
+ let g:ale_buffer_info[bufnr('') + 2].loclist =
+ \ ale#engine#FixLocList(bufnr('') + 2, 'linter_two', [
+ \ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
+ \ {'lnum': 3, 'filename': expand('%:p'), 'text': 'baz'},
+ \ {'lnum': 5, 'text': 'ignore this one'},
+ \ ])
+
+ call ale#linter#Define('foobar', {
+ \ 'name': 'linter_one',
+ \ 'callback': 'WhoCares',
+ \ 'executable': 'echo',
+ \ 'command': 'echo',
+ \ 'lint_file': 1,
+ \})
+ call ale#linter#Define('foobar', {
+ \ 'name': 'linter_two',
+ \ 'callback': 'WhoCares',
+ \ 'executable': 'echo',
+ \ 'command': 'echo',
+ \})
+
+After:
+ call ale#engine#Cleanup(bufnr(''))
+ Restore
+ call ale#linter#Reset()
+
+ " Items and markers, etc.
+ call setloclist(0, [])
+ call clearmatches()
+ sign unplace *
+
+Given foobar(A file with some lines):
+ foo
+ bar
+ baz
+
+Execute(Problems found from previously opened buffers should be set when linting for the first time):
+ call ale#engine#RunLinters(bufnr(''), ale#linter#Get(&filetype), 0)
+
+ AssertEqual
+ \ [
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 0, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'E', 'pattern': '', 'text': 'foo'},
+ \ {'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)