summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYining <zhang.yining@gmail.com>2022-11-06 08:32:51 +0800
committerGitHub <noreply@github.com>2022-11-06 09:32:51 +0900
commitedffffac2570cf837badf4195fb3d55ae439af7d (patch)
tree7bb57352a3f1224ceb5c05b8c3a74aaf513d7e46 /test
parent07bd24d0fd767e9c584a45d43f23e8d5956665fe (diff)
downloadale-edffffac2570cf837badf4195fb3d55ae439af7d.zip
add: support config option for checkmake linter (#4351)
`checkmake` by default checks config file "in the same folder it's executed in" unless `--config` option is set. This commit allows setting the `--config` option with an option variable (with documentation updated).
Diffstat (limited to 'test')
-rw-r--r--test/linter/test_checkmake.vader39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/linter/test_checkmake.vader b/test/linter/test_checkmake.vader
new file mode 100644
index 00000000..ec8a4b83
--- /dev/null
+++ b/test/linter/test_checkmake.vader
@@ -0,0 +1,39 @@
+Before:
+ Save g:ale_make_checkmake_config
+
+ let g:ale_make_checkmake_config = ''
+
+ call ale#assert#SetUpLinterTest('make', 'checkmake')
+
+ " NOTE: the format string must be manually matched that set in the plugin
+ let b:format = '"{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"'
+
+After:
+ Restore
+
+ unlet! b:command_tail
+ unlet! b:ale_make_checkmake_config
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(checkmake should run with default format option):
+ let b:command_tail = ' --format=' . b:format . ' %s'
+
+ AssertLinter 'checkmake', 'checkmake' . b:command_tail
+
+Execute(checkmake command should take the config option if it is non-empty):
+ let g:ale_make_checkmake_config = '/path to/checkmake.ini'
+ let b:command_tail = ' --format=' . b:format
+ \ . ' --config="' . g:ale_make_checkmake_config . '"'
+ \ . ' %s'
+
+ AssertLinter 'checkmake', 'checkmake' . b:command_tail
+
+Execute(the local buffer config option takes precedence over global option):
+ let g:ale_make_checkmake_config = '/path/to/checkmake.ini'
+ let b:ale_make_checkmake_config = '/another/checkmake.ini'
+ let b:command_tail = ' --format=' . b:format
+ \ . ' --config="' . b:ale_make_checkmake_config . '"'
+ \ . ' %s'
+
+ AssertLinter 'checkmake', 'checkmake' . b:command_tail