summaryrefslogtreecommitdiff
path: root/test/linter/test_luacheck.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/linter/test_luacheck.vader')
-rw-r--r--test/linter/test_luacheck.vader20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/linter/test_luacheck.vader b/test/linter/test_luacheck.vader
index f0ef221c..1d7276b7 100644
--- a/test/linter/test_luacheck.vader
+++ b/test/linter/test_luacheck.vader
@@ -1,14 +1,19 @@
Before:
call ale#assert#SetUpLinterTest('lua', 'luacheck')
+ " Default to testing linting Lua not in Vim directories.
+ call ale#test#SetFilename('/test.lua')
After:
+ " Clear the variable for saving the result of the runtime check.
+ " We don't want to cache the result between tests.
+ unlet! b:ale_in_runtimepath
call ale#assert#TearDownLinterTest()
-Execute(The lua luacheck command callback should return the correct default string):
+Execute(The luacheck default command should be correct):
AssertLinter 'luacheck',
\ ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -'
-Execute(The lua luacheck command callback should let you set options):
+Execute(You should be able to set luacheck options):
let g:ale_lua_luacheck_options = '--config filename'
AssertLinter 'luacheck',
@@ -21,3 +26,14 @@ Execute(The luacheck executable should be configurable):
AssertLinter 'luacheck.sh',
\ ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -'
+
+Execute(The luacheck command should include vim as a global if in runtimepath):
+ call ale#test#SetFilename('test.lua')
+ AssertLinter 'luacheck',
+ \ ale#Escape('luacheck') . ' --globals vim --formatter plain --codes --filename %s -'
+
+Execute(The default Vim globals should not be set if globals are already set):
+ call ale#test#SetFilename('test.lua')
+ let g:ale_lua_luacheck_options = '--globals foo'
+ AssertLinter 'luacheck',
+ \ ale#Escape('luacheck') . ' --globals foo --formatter plain --codes --filename %s -'