diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-01-19 17:10:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-19 17:10:29 +0000 |
commit | 7b50b3ec8249af6107a12a03820fb35854014b95 (patch) | |
tree | 9c8010e33596299f87f41585ffc23b120f4cab20 /test | |
parent | a5ec4143d2ed0527649d4143e244b62b9f879661 (diff) | |
parent | 547716eabb3a436f2de623555fb488d3496ccbd4 (diff) | |
download | ale-7b50b3ec8249af6107a12a03820fb35854014b95.zip |
Merge pull request #1272 from Codezerker/master
Add a luac linter for Lua
Diffstat (limited to 'test')
-rw-r--r-- | test/command_callback/test_luac_command_callback.vader | 16 | ||||
-rw-r--r-- | test/handler/test_luac_handler.vader | 36 | ||||
-rw-r--r-- | test/handler/test_luacheck_handler.vader (renamed from test/handler/test_lua_handler.vader) | 0 |
3 files changed, 52 insertions, 0 deletions
diff --git a/test/command_callback/test_luac_command_callback.vader b/test/command_callback/test_luac_command_callback.vader new file mode 100644 index 00000000..f9eb4d3f --- /dev/null +++ b/test/command_callback/test_luac_command_callback.vader @@ -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))) diff --git a/test/handler/test_luac_handler.vader b/test/handler/test_luac_handler.vader new file mode 100644 index 00000000..3a2e769c --- /dev/null +++ b/test/handler/test_luac_handler.vader @@ -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 '')''', + \ ]) + diff --git a/test/handler/test_lua_handler.vader b/test/handler/test_luacheck_handler.vader index 7cebb017..7cebb017 100644 --- a/test/handler/test_lua_handler.vader +++ b/test/handler/test_luacheck_handler.vader |