Merge pull request #1272 from Codezerker/master
Add a luac linter for Lua
This commit is contained in:
commit
7b50b3ec82
7 changed files with 104 additions and 2 deletions
16
test/command_callback/test_luac_command_callback.vader
Normal file
16
test/command_callback/test_luac_command_callback.vader
Normal file
|
@ -0,0 +1,16 @@
|
|||
Before:
|
||||
runtime ale_linters/lua/luac.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual ale#Escape('luac') . ' -p -',
|
||||
\ join(split(ale_linters#lua#luac#GetCommand(1)))
|
||||
|
||||
Execute(The luac executable should be configurable):
|
||||
let g:ale_lua_luac_executable = 'luac.sh'
|
||||
|
||||
AssertEqual 'luac.sh', ale_linters#lua#luac#GetExecutable(1)
|
||||
AssertEqual ale#Escape('luac.sh') . ' -p -',
|
||||
\ join(split(ale_linters#lua#luac#GetCommand(1)))
|
36
test/handler/test_luac_handler.vader
Normal file
36
test/handler/test_luac_handler.vader
Normal file
|
@ -0,0 +1,36 @@
|
|||
Before:
|
||||
Save g:ale_warn_about_trailing_whitespace
|
||||
|
||||
let g:ale_warn_about_trailing_whitespace = 1
|
||||
|
||||
runtime ale_linters/lua/luac.vim
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The luac handler should parse lines correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'line contains trailing whitespace',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'text': 'unexpected symbol near ''-''',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'text': '''='' expected near '')''',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#lua#luac#Handle(347, [
|
||||
\ 'luac /file/path/here.lua:1: line contains trailing whitespace',
|
||||
\ 'luac /file/path/here.lua:3: unexpected symbol near ''-''',
|
||||
\ 'luac /file/path/here.lua:5: ''='' expected near '')''',
|
||||
\ ])
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue