diff options
Diffstat (limited to 'test/command_callback')
5 files changed, 39 insertions, 13 deletions
diff --git a/test/command_callback/test_gobuild_command_callback.vader b/test/command_callback/test_gobuild_command_callback.vader index f9673213..8acbec56 100644 --- a/test/command_callback/test_gobuild_command_callback.vader +++ b/test/command_callback/test_gobuild_command_callback.vader @@ -1,9 +1,12 @@ Before: + Save g:ale_go_go_executable + call ale#assert#SetUpLinterTest('go', 'gobuild') WithChainResults ['/foo/bar', '/foo/baz'] After: + Restore call ale#assert#TearDownLinterTest() Execute(The default commands should be correct): @@ -17,3 +20,12 @@ Execute(Extra options should be supported): AssertLinter 'go', \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' \ . 'go test --foo-bar -c -o /dev/null ./' + + let g:ale_go_gobuild_options = '' + +Execute(The executable should be configurable): + let g:ale_go_go_executable = 'foobar' + + AssertLinter 'foobar', + \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' + \ . 'foobar test -c -o /dev/null ./' diff --git a/test/command_callback/test_govet_command_callback.vader b/test/command_callback/test_govet_command_callback.vader index 3718e0a7..ab93a5cb 100644 --- a/test/command_callback/test_govet_command_callback.vader +++ b/test/command_callback/test_govet_command_callback.vader @@ -1,12 +1,19 @@ Before: + Save g:ale_go_go_executable + Save g:ale_go_govet_options call ale#assert#SetUpLinterTest('go', 'govet') After: + Restore call ale#assert#TearDownLinterTest() Execute(The default command should be correct): - AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .' + AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .' Execute(Extra options should be supported): let g:ale_go_govet_options = '--foo-bar' - AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet . --foo-bar' + AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet --foo-bar .' + +Execute(The executable should be configurable): + let g:ale_go_go_executable = 'foobar' + AssertLinter 'foobar', 'cd ' . ale#Escape(expand('%:p:h')) . ' && foobar vet .' diff --git a/test/command_callback/test_julia_languageserver_callbacks.vader b/test/command_callback/test_julia_languageserver_callbacks.vader index a1f3a1ae..3bc46e3d 100644 --- a/test/command_callback/test_julia_languageserver_callbacks.vader +++ b/test/command_callback/test_julia_languageserver_callbacks.vader @@ -1,14 +1,18 @@ Before: + Save g:ale_julia_executable + call ale#assert#SetUpLinterTest('julia', 'languageserver') After: + Restore + call ale#assert#TearDownLinterTest() Execute(The default executable path should be correct): AssertLinter 'julia', \ ale#Escape('julia') . \' --startup-file=no --history-file=no -e ' . - \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);') + \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);') Execute(The executable should be configurable): let g:ale_julia_executable = 'julia-new' @@ -16,7 +20,7 @@ Execute(The executable should be configurable): AssertLinter 'julia-new', \ ale#Escape('julia-new') . \' --startup-file=no --history-file=no -e ' . - \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);') + \ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);') Execute(The project root should be detected correctly): AssertLSPProject '' diff --git a/test/command_callback/test_ruby_solargraph.vader b/test/command_callback/test_ruby_solargraph.vader index b9dd46d8..b39f686e 100644 --- a/test/command_callback/test_ruby_solargraph.vader +++ b/test/command_callback/test_ruby_solargraph.vader @@ -7,30 +7,33 @@ Before: After: call ale#assert#TearDownLinterTest() +Execute(command callback should return default string): + AssertLinter 'solargraph', ale#Escape('solargraph') . ' stdio' + +Execute(command callback executable can be overridden): + let g:ale_ruby_solargraph_executable = 'foobar' + AssertLinter 'foobar', ale#Escape('foobar') . ' stdio' + Execute(should set solargraph for rails app): call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/models/thing.rb') AssertLSPLanguage 'ruby' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_rails_app') - AssertLSPAddress '127.0.0.1:7658' Execute(should set solargraph for ruby app1): call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app1/lib/file.rb') AssertLSPLanguage 'ruby' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app1') - AssertLSPAddress '127.0.0.1:7658' Execute(should set solargraph for ruby app2): call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app2/lib/file.rb') AssertLSPLanguage 'ruby' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2') - AssertLSPAddress '127.0.0.1:7658' Execute(should set solargraph for ruby app3): call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app3/lib/file.rb') AssertLSPLanguage 'ruby' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app3') - AssertLSPAddress '127.0.0.1:7658' diff --git a/test/command_callback/test_thrift_command_callback.vader b/test/command_callback/test_thrift_command_callback.vader index ea217259..cbada818 100644 --- a/test/command_callback/test_thrift_command_callback.vader +++ b/test/command_callback/test_thrift_command_callback.vader @@ -23,22 +23,22 @@ After: call ale#assert#TearDownLinterTest() Execute(The default command should be correct): - AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -strict' . b:suffix + AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix Execute(The executable should be configurable): let b:ale_thrift_thrift_executable = 'foobar' - AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -strict' . b:suffix + AssertLinter 'foobar', ale#Escape('foobar') . ' --gen cpp -I . -strict' . b:suffix Execute(The list of generators should be configurable): let b:ale_thrift_thrift_generators = ['java', 'py:dynamic'] AssertLinter 'thrift', ale#Escape('thrift') - \ . ' --gen java --gen py:dynamic -strict' . b:suffix + \ . ' --gen java --gen py:dynamic -I . -strict' . b:suffix let b:ale_thrift_thrift_generators = [] - AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -strict' . b:suffix + AssertLinter 'thrift', ale#Escape('thrift') . ' --gen cpp -I . -strict' . b:suffix Execute(The list of include paths should be configurable): let b:ale_thrift_thrift_includes = ['included/path'] @@ -50,4 +50,4 @@ Execute(The string of compiler options should be configurable): let b:ale_thrift_thrift_options = '-strict --allow-64bit-consts' AssertLinter 'thrift', ale#Escape('thrift') - \ . ' --gen cpp -strict --allow-64bit-consts' . b:suffix + \ . ' --gen cpp -I . -strict --allow-64bit-consts' . b:suffix |