summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-07-07 00:10:30 +0100
committerw0rp <devw0rp@gmail.com>2017-07-07 00:10:30 +0100
commit8315c0e3377921435af06a3182bdc0f1f0f222fc (patch)
treeb951412a91c66c6fc914849c2309dda2b7befc9c /test
parent854066e8499344a6461fef8fd0ee4b3f8eaebeeb (diff)
downloadale-8315c0e3377921435af06a3182bdc0f1f0f222fc.zip
Make the executable for gometalinter configurable
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_gometalinter_command_callback.vader53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/command_callback/test_gometalinter_command_callback.vader b/test/command_callback/test_gometalinter_command_callback.vader
new file mode 100644
index 00000000..dcaf03b0
--- /dev/null
+++ b/test/command_callback/test_gometalinter_command_callback.vader
@@ -0,0 +1,53 @@
+Before:
+ Save b:ale_go_gometalinter_executable
+ Save b:ale_go_gometalinter_options
+
+ let b:ale_go_gometalinter_executable = 'gometalinter'
+ let b:ale_go_gometalinter_options = ''
+
+ runtime ale_linters/go/gometalinter.vim
+
+ silent! cd /testplugin/test/command_callback
+ let g:dir = getcwd()
+
+ call ale#test#SetFilename('test.go')
+
+After:
+ Restore
+
+ silent execute 'cd ' . fnameescape(g:dir)
+ unlet! g:dir
+
+ call ale#linter#Reset()
+
+Execute(The gometalinter callback should return the right defaults):
+ AssertEqual
+ \ 'gometalinter',
+ \ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('gometalinter')
+ \ . ' --include=''^' . expand('%:p') . '.*$'''
+ \ . ' ' . ale#Escape(getcwd()),
+ \ ale_linters#go#gometalinter#GetCommand(bufnr(''))
+
+Execute(The gometalinter callback should use a configured executable):
+ let b:ale_go_gometalinter_executable = 'something else'
+
+ AssertEqual
+ \ 'something else',
+ \ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('something else')
+ \ . ' --include=''^' . expand('%:p') . '.*$'''
+ \ . ' ' . ale#Escape(getcwd()),
+ \ ale_linters#go#gometalinter#GetCommand(bufnr(''))
+
+Execute(The gometalinter callback should use configured options):
+ let b:ale_go_gometalinter_options = '--foobar'
+
+ AssertEqual
+ \ ale#Escape('gometalinter')
+ \ . ' --include=''^' . expand('%:p') . '.*$'''
+ \ . ' --foobar'
+ \ . ' ' . ale#Escape(getcwd()),
+ \ ale_linters#go#gometalinter#GetCommand(bufnr(''))