ale/test/handler/test_ansible_lint_handler.vader

59 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

Before:
runtime ale_linters/ansible/ansible_lint.vim
call ale#test#SetFilename('main.yml')
let b:ale_warn_about_trailing_whitespace = 1
After:
unlet! b:ale_warn_about_trailing_whitespace
call ale#linter#Reset()
Execute(The ansible-lint handler should handle basic errors):
AssertEqual
\ [
\ {
\ 'lnum': 35,
\ 'col': 0,
\ 'type': 'E',
\ 'text': 'Trailing whitespace',
\ 'code': 'EANSIBLE0002',
\ },
\ ],
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
\ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
\ ])
Execute(The ansible-lint handler should supress trailing whitespace output when the option is used):
let b:ale_warn_about_trailing_whitespace = 0
AssertEqual
\ [
\ ],
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
\ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace',
\ ])
Execute (The ansible-lint handler should handle names with spaces):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 6,
\ 'type': 'E',
\ 'text': 'indentation is not a multiple of four',
\ 'code': 'E111',
\ },
\ ],
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
\ fnamemodify(tempname(), ':h') . '/main.yml:6:6: E111 indentation is not a multiple of four',
\ ])
Execute (The ansible-lint handler should ignore errors from other files):
AssertEqual
\ [
\ ],
\ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [
\ '/foo/bar/roles/main.yml:6:6: E111 indentation is not a multiple of four',
\ ])