test_luacheck_handler.vader
1 Before: 2 Save g:ale_warn_about_trailing_whitespace 3 4 let g:ale_warn_about_trailing_whitespace = 1 5 6 runtime ale_linters/lua/luacheck.vim 7 8 After: 9 Restore 10 call ale#linter#Reset() 11 12 Execute(The luacheck handler should parse lines correctly): 13 AssertEqual 14 \ [ 15 \ { 16 \ 'lnum': 1, 17 \ 'col': 8, 18 \ 'text': 'line contains trailing whitespace', 19 \ 'code': 'W612', 20 \ 'type': 'W', 21 \ }, 22 \ { 23 \ 'lnum': 3, 24 \ 'col': 5, 25 \ 'text': 'unused loop variable ''k''', 26 \ 'code': 'W213', 27 \ 'type': 'W', 28 \ }, 29 \ { 30 \ 'lnum': 3, 31 \ 'col': 19, 32 \ 'text': 'accessing undefined variable ''x''', 33 \ 'code': 'W113', 34 \ 'type': 'W', 35 \ }, 36 \ ], 37 \ ale_linters#lua#luacheck#Handle(347, [ 38 \ ' /file/path/here.lua:1:8: (W612) line contains trailing whitespace', 39 \ ' /file/path/here.lua:3:5: (W213) unused loop variable ''k''', 40 \ ' /file/path/here.lua:3:19: (W113) accessing undefined variable ''x''', 41 \ ]) 42 43 Execute(The luacheck handler should respect the warn_about_trailing_whitespace option): 44 let g:ale_warn_about_trailing_whitespace = 0 45 46 AssertEqual 47 \ [ 48 \ { 49 \ 'lnum': 5, 50 \ 'col': 43, 51 \ 'text': 'unused argument ''g''', 52 \ 'code': 'W212', 53 \ 'type': 'W', 54 \ } 55 \ ], 56 \ ale_linters#lua#luacheck#Handle(347, [ 57 \ '/file/path/here.lua:15:97: (W614) trailing whitespace in a comment', 58 \ '/file/path/here.lua:16:60: (W612) line contains trailing whitespace', 59 \ '/file/path/here.lua:17:1: (W611) line contains only whitespace', 60 \ '/file/path/here.lua:27:57: (W613) trailing whitespace in a string', 61 \ '/file/path/here.lua:5:43: (W212) unused argument ''g''', 62 \ ])