summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-30 16:19:40 +0900
committerGitHub <noreply@github.com>2021-01-30 16:19:40 +0900
commit7c44f4e403a85ac9707c121bff3ad08a65443f0c (patch)
treee4ded948e416629e2445bea10a6ab68f6e8ce973 /test/command_callback
parent82c8e3a3a3740b520c748ff181e5c29f508b8455 (diff)
parent64d430438ee75f7da5468c3820e1f32e8185f165 (diff)
downloadale-7c44f4e403a85ac9707c121bff3ad08a65443f0c.zip
Merge pull request #3565 from hsanson/3371-add-terraform-ls-support
Fix 3371 - Add terraform-ls support
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_terraform_ls_command_callback.vader61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/command_callback/test_terraform_ls_command_callback.vader b/test/command_callback/test_terraform_ls_command_callback.vader
new file mode 100644
index 00000000..d559ba8c
--- /dev/null
+++ b/test/command_callback/test_terraform_ls_command_callback.vader
@@ -0,0 +1,61 @@
+Before:
+ call ale#assert#SetUpLinterTest('terraform', 'terraform_ls')
+
+After:
+ if isdirectory(g:dir . '/.terraform')
+ call delete(g:dir . '/.terraform', 'd')
+ endif
+
+ unlet! b:ale_terraform_terraform_executable
+ unlet! b:ale_terraform_ls_executable
+ unlet! b:ale_terraform_ls_options
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(Should send correct LSP language):
+ AssertLSPLanguage 'terraform'
+
+Execute(Should load default executable):
+ AssertLinter 'terraform-ls',
+ \ ale#Escape('terraform-ls') . ' serve'
+
+Execute(Should configure custom executable):
+ let b:ale_terraform_ls_executable = 'foo'
+ AssertLinter 'foo',
+ \ ale#Escape('foo') . ' serve'
+
+Execute(Should ignore non-absolute custom terraform executable):
+ let b:ale_terraform_terraform_executable = 'terraform'
+ AssertLinter 'terraform-ls',
+ \ ale#Escape('terraform-ls') . ' serve'
+
+Execute(Should set absolute custom terraform executable):
+ let b:ale_terraform_terraform_executable = '/bin/terraform'
+ AssertLinter 'terraform-ls',
+ \ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform'
+
+Execute(Should set custom options):
+ let b:ale_terraform_ls_options = '--bar'
+
+ AssertLinter 'terraform-ls',
+ \ ale#Escape('terraform-ls') . ' serve --bar'
+
+Execute(Should return current directory if it contains .terraform directory):
+ call mkdir(g:dir . '/.terraform')
+ AssertLSPProject g:dir
+
+Execute(Should return nearest directory with .terraform if found in parent directory):
+ call ale#test#SetFilename('../terraform_files/main.tf')
+
+ let b:parent_dir = ale#path#Simplify(g:dir . '/..')
+ let b:tf_dir = b:parent_dir . '/.terraform'
+
+ if !isdirectory(b:tf_dir)
+ call mkdir(b:tf_dir)
+ endif
+
+ AssertLSPProject b:parent_dir
+
+ call delete(b:tf_dir, 'd')
+ unlet!b:parent_dir
+ unlet!b:tf_dir