summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2020-08-17 23:37:23 +0100
committerGitHub <noreply@github.com>2020-08-17 23:37:23 +0100
commitbc6304bdb0361b3236222cf857427a924c9e2c4d (patch)
tree05eeb3779c913608850f58597480ded3a03d2f78 /test/command_callback
parentac56574b55a11a8a921bb5169dd4dd3a7348aeeb (diff)
parent2548763d04568823c4ef240f7f115adbb1dcfca2 (diff)
downloadale-bc6304bdb0361b3236222cf857427a924c9e2c4d.zip
Merge pull request #3007 from klaaspieter/swift-format
Add Apple's swift-format as a linter
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_swift_swiftformat_command_callbacks.vader25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/command_callback/test_swift_swiftformat_command_callbacks.vader b/test/command_callback/test_swift_swiftformat_command_callbacks.vader
new file mode 100644
index 00000000..7be20bf7
--- /dev/null
+++ b/test/command_callback/test_swift_swiftformat_command_callbacks.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('../swift-test-files/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('../swift-test-files/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('../swift-test-files/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'