summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_terraform_lsp_command_callback.vader48
-rw-r--r--test/terraform_files/main.tf0
2 files changed, 48 insertions, 0 deletions
diff --git a/test/command_callback/test_terraform_lsp_command_callback.vader b/test/command_callback/test_terraform_lsp_command_callback.vader
new file mode 100644
index 00000000..7a491d54
--- /dev/null
+++ b/test/command_callback/test_terraform_lsp_command_callback.vader
@@ -0,0 +1,48 @@
+Before:
+ call ale#assert#SetUpLinterTest('terraform', 'terraform_lsp')
+
+After:
+ if isdirectory(g:dir . '/.terraform')
+ call delete(g:dir . '/.terraform', 'd')
+ endif
+
+ unlet! b:ale_terraform_langserver_executable
+ unlet! b:ale_terraform_langserver_options
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(Should send correct LSP language):
+ AssertLSPLanguage 'terraform'
+
+Execute(Should load default executable):
+ AssertLinter 'terraform-lsp', ale#Escape('terraform-lsp')
+
+Execute(Should configure custom executable):
+ let b:ale_terraform_langserver_executable = 'foo'
+ AssertLinter 'foo', ale#Escape('foo')
+
+Execute(Should set custom options):
+ let b:ale_terraform_langserver_options = '--bar'
+
+ AssertLinter 'terraform-lsp',
+ \ ale#Escape('terraform-lsp') . ' --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
diff --git a/test/terraform_files/main.tf b/test/terraform_files/main.tf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/terraform_files/main.tf