summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_nimlsp_command_callback.vader12
-rw-r--r--test/nim-test-files/with-git/src/source.nim0
-rw-r--r--test/test_nimlsp_project_root.vader19
3 files changed, 31 insertions, 0 deletions
diff --git a/test/command_callback/test_nimlsp_command_callback.vader b/test/command_callback/test_nimlsp_command_callback.vader
new file mode 100644
index 00000000..c109deef
--- /dev/null
+++ b/test/command_callback/test_nimlsp_command_callback.vader
@@ -0,0 +1,12 @@
+Before:
+ call ale#assert#SetUpLinterTest('nim', 'nimlsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(It does not set nim sources by default):
+ AssertLinter 'nimlsp', ale#Escape('nimlsp')
+
+Execute(Sets nimlsp and escapes sources from g:ale_nim_nimlsp_nim_sources):
+ let g:ale_nim_nimlsp_nim_sources = '/path/to /Nim'
+ AssertLinter 'nimlsp', ale#Escape('nimlsp') . ' ' . ale#Escape('/path/to /Nim')
diff --git a/test/nim-test-files/with-git/src/source.nim b/test/nim-test-files/with-git/src/source.nim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/nim-test-files/with-git/src/source.nim
diff --git a/test/test_nimlsp_project_root.vader b/test/test_nimlsp_project_root.vader
new file mode 100644
index 00000000..e7027575
--- /dev/null
+++ b/test/test_nimlsp_project_root.vader
@@ -0,0 +1,19 @@
+Before:
+ runtime ale_linters/nim/nimlsp.vim
+ call ale#test#SetDirectory('/testplugin/test')
+
+After:
+ if isdirectory(g:dir . '/.git')
+ call delete(g:dir . '/.git', 'd')
+ endif
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+
+Execute(Detect root of nim project with .git/ correctly):
+ call ale#test#SetFilename('nim-test-files/with-git/src/source.nim')
+ call mkdir(g:dir . '/.git')
+ AssertEqual
+ \ ale#path#Simplify(g:dir),
+ \ ale_linters#nim#nimlsp#GetProjectRoot(bufnr(''))