ale/test/handler/test_lua_handler.vader

59 lines
1.6 KiB
Plaintext

Before:
Save g:ale_warn_about_trailing_whitespace
After:
Restore
call ale#linter#Reset()
Execute(The luacheck handler should parse lines correctly):
runtime ale_linters/lua/luacheck.vim
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'col': 8,
\ 'text': 'W612: line contains trailing whitespace',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 3,
\ 'col': 5,
\ 'text': 'W213: unused loop variable ''k''',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 3,
\ 'col': 19,
\ 'text': 'W113: accessing undefined variable ''x''',
\ 'type': 'W',
\ },
\ ],
\ ale_linters#lua#luacheck#Handle(347, [
\ ' /file/path/here.lua:1:8: (W612) line contains trailing whitespace',
\ ' /file/path/here.lua:3:5: (W213) unused loop variable ''k''',
\ ' /file/path/here.lua:3:19: (W113) accessing undefined variable ''x''',
\ ])
Execute(The luacheck handler should respect the warn_about_trailing_whitespace option):
runtime ale_linters/lua/luacheck.vim
let g:ale_warn_about_trailing_whitespace = 0
AssertEqual
\ [
\ {
\ 'lnum': 5,
\ 'col': 43,
\ 'text': 'W212: unused argument ''g''',
\ 'type': 'W',
\ }
\ ],
\ ale_linters#lua#luacheck#Handle(347, [
\ '/file/path/here.lua:15:97: (W614) trailing whitespace in a comment',
\ '/file/path/here.lua:16:60: (W612) line contains trailing whitespace',
\ '/file/path/here.lua:17:1: (W611) line contains only whitespace',
\ '/file/path/here.lua:27:57: (W613) trailing whitespace in a string',
\ '/file/path/here.lua:5:43: (W212) unused argument ''g''',
\ ])