summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader21
-rw-r--r--test/swift-test-files/non-swift-package-project/src/folder/dummy.swift0
-rw-r--r--test/swift-test-files/swift-package-project/Package.swift0
-rw-r--r--test/swift-test-files/swift-package-project/src/folder/dummy.swift0
-rw-r--r--test/test_swift_find_project_root.vader18
5 files changed, 39 insertions, 0 deletions
diff --git a/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader b/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader
new file mode 100644
index 00000000..4611c6de
--- /dev/null
+++ b/test/command_callback/test_swift_sourcekitlsp_command_callbacks.vader
@@ -0,0 +1,21 @@
+Before:
+ call ale#assert#SetUpLinterTest('swift', 'sourcekitlsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default executable path should be correct):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'sourcekit-lsp', ale#Escape('sourcekit-lsp')
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ let g:ale_sourcekit_lsp_executable = '/path/to/custom/sourcekitlsp'
+
+ AssertLinter '/path/to/custom/sourcekitlsp',
+ \ ale#Escape('/path/to/custom/sourcekitlsp')
+
+Execute(The language should be correct):
+ AssertLSPLanguage 'swift'
diff --git a/test/swift-test-files/non-swift-package-project/src/folder/dummy.swift b/test/swift-test-files/non-swift-package-project/src/folder/dummy.swift
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/swift-test-files/non-swift-package-project/src/folder/dummy.swift
diff --git a/test/swift-test-files/swift-package-project/Package.swift b/test/swift-test-files/swift-package-project/Package.swift
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/swift-test-files/swift-package-project/Package.swift
diff --git a/test/swift-test-files/swift-package-project/src/folder/dummy.swift b/test/swift-test-files/swift-package-project/src/folder/dummy.swift
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/swift-test-files/swift-package-project/src/folder/dummy.swift
diff --git a/test/test_swift_find_project_root.vader b/test/test_swift_find_project_root.vader
new file mode 100644
index 00000000..7cb1cc29
--- /dev/null
+++ b/test/test_swift_find_project_root.vader
@@ -0,0 +1,18 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(Detect root of Swift project with Package.swift correctly):
+ call ale#test#SetFilename('swift-test-files/swift-package-project/src/folder/dummy.swift')
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/swift-test-files/swift-package-project'),
+ \ ale#swift#FindProjectRoot(bufnr(''))
+
+Execute(Detect no root in case of non-Package.swift project):
+ call ale#test#SetFilename('swift-test-files/non-swift-package-project/src/folder/dummy.swift')
+ AssertEqual
+ \ '',
+ \ ale#swift#FindProjectRoot(bufnr(''))
+