summaryrefslogtreecommitdiff
path: root/test/linter/test_swift_swiftformat.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/linter/test_swift_swiftformat.vader')
-rw-r--r--test/linter/test_swift_swiftformat.vader25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/linter/test_swift_swiftformat.vader b/test/linter/test_swift_swiftformat.vader
new file mode 100644
index 00000000..9f6ee62e
--- /dev/null
+++ b/test/linter/test_swift_swiftformat.vader
@@ -0,0 +1,25 @@
+Before:
+ call ale#assert#SetUpLinterTest('swift', 'swiftformat')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(Should use default command when not in a swift package):
+ call ale#test#SetFilename('../test-files/swift/non-swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift-format',
+ \ ale#Escape('swift-format') . ' --mode lint %t'
+
+Execute(Should use swift run when in a swift package):
+ call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift',
+ \ ale#Escape('swift') . ' run swift-format --mode lint %t'
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift')
+
+ let g:ale_swift_swiftformat_executable = '/path/to/custom/swift-format'
+
+ AssertLinter '/path/to/custom/swift-format',
+ \ ale#Escape('/path/to/custom/swift-format') . ' --mode lint %t'