summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-08-19 15:37:06 +0100
committerGitHub <noreply@github.com>2017-08-19 15:37:06 +0100
commitf8de08faf0c23ac4b76e610f685dcf6c3dfdf180 (patch)
treeef1fbc0fbc00d148566ebecf00cc03d63e20b1e7
parentfb0c931b2ddd0441c04a3e1c9d5d6def87e8858e (diff)
parent18cb9a725d49c674b029110be274ae9606f2270d (diff)
downloadale-f8de08faf0c23ac4b76e610f685dcf6c3dfdf180.zip
Merge pull request #860 from dmitrivereshchagin/update-syntaxerl-linter
Add original filename to SyntaxErl command
-rw-r--r--ale_linters/erlang/syntaxerl.vim2
-rw-r--r--test/command_callback/test_erlang_syntaxerl_command_callback.vader26
-rw-r--r--test/handler/test_syntaxerl_handler.vader4
3 files changed, 29 insertions, 3 deletions
diff --git a/ale_linters/erlang/syntaxerl.vim b/ale_linters/erlang/syntaxerl.vim
index dd53d8e8..7a94856a 100644
--- a/ale_linters/erlang/syntaxerl.vim
+++ b/ale_linters/erlang/syntaxerl.vim
@@ -10,7 +10,7 @@ endfunction
function! ale_linters#erlang#syntaxerl#GetCommand(buffer) abort
- return ale_linters#erlang#syntaxerl#GetExecutable(a:buffer) . ' %t'
+ return ale_linters#erlang#syntaxerl#GetExecutable(a:buffer) . ' -b %s %t'
endfunction
diff --git a/test/command_callback/test_erlang_syntaxerl_command_callback.vader b/test/command_callback/test_erlang_syntaxerl_command_callback.vader
new file mode 100644
index 00000000..800aaf3f
--- /dev/null
+++ b/test/command_callback/test_erlang_syntaxerl_command_callback.vader
@@ -0,0 +1,26 @@
+Before:
+ Save g:ale_erlang_syntaxerl_executable
+ unlet! g:ale_erlang_syntaxerl_executable b:ale_erlang_syntaxerl_executable
+ runtime ale_linters/erlang/syntaxerl.vim
+
+After:
+ call ale#linter#Reset()
+ Restore g:ale_erlang_syntaxerl_executable
+
+Execute (Get SyntaxErl executable):
+ AssertEqual 'syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
+
+ let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
+ AssertEqual '/some/other/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
+
+ let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
+ AssertEqual '/yet/another/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
+
+Execute (Get SyntaxErl command line):
+ AssertEqual 'syntaxerl -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''))
+
+ let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
+ AssertEqual '/some/other/syntaxerl -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''))
+
+ let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
+ AssertEqual '/yet/another/syntaxerl -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''))
diff --git a/test/handler/test_syntaxerl_handler.vader b/test/handler/test_syntaxerl_handler.vader
index 1308ec84..95f2bfef 100644
--- a/test/handler/test_syntaxerl_handler.vader
+++ b/test/handler/test_syntaxerl_handler.vader
@@ -4,7 +4,7 @@ Before:
After:
call ale#linter#Reset()
-Execute:
+Execute (Handle SyntaxErl output):
AssertEqual
\ [
\ {
@@ -18,7 +18,7 @@ Execute:
\ 'type': 'W',
\ },
\ ],
- \ ale_linters#erlang#syntaxerl#Handle(42, [
+ \ ale_linters#erlang#syntaxerl#Handle(bufnr(''), [
\ "/tmp/v2wDixk/1/module.erl:42: syntax error before: ','",
\ '/tmp/v2wDixk/2/module.erl:42: warning: function foo/0 is unused',
\ ])