Skip to content

Commit

Permalink
Cover the SaveEvent function with a test
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rp committed Jul 31, 2017
1 parent a4ffd2f commit 35913d9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_lint_file_linters.vader
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,30 @@ Execute(Linter errors from files should be kept when no other linters are run):
\ 'type': 'E',
\ },
\], GetSimplerLoclist()

Execute(The Save event should respect the buffer number):
let g:ale_linters = {'foobar': ['lint_file_linter']}
Assert filereadable(expand('%:p')), 'The file was not readable'

call ale#events#SaveEvent(bufnr('') + 1)

" We shouldn't get any prblems yet.
AssertEqual [], GetSimplerLoclist()

call ale#events#SaveEvent(bufnr(''))

" We should get them now we used the right buffer number.
AssertEqual [
\ {
\ 'lnum': 1,
\ 'col': 3,
\ 'text': 'file warning',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 2,
\ 'col': 3,
\ 'text': 'file error',
\ 'type': 'E',
\ },
\], GetSimplerLoclist()

0 comments on commit 35913d9

Please sign in to comment.