diff options
Diffstat (limited to 'test/linter')
-rw-r--r-- | test/linter/test_swift_appleswiftformat.vader | 42 | ||||
-rw-r--r-- | test/linter/test_swift_swiftformat.vader | 25 |
2 files changed, 42 insertions, 25 deletions
diff --git a/test/linter/test_swift_appleswiftformat.vader b/test/linter/test_swift_appleswiftformat.vader new file mode 100644 index 00000000..3dbae8ff --- /dev/null +++ b/test/linter/test_swift_appleswiftformat.vader @@ -0,0 +1,42 @@ +Before: + call ale#assert#SetUpLinterTest('swift', 'appleswiftformat') + +After: + call ale#assert#TearDownLinterTest() + +Execute(Should use default command when use_swiftpm is not set): + call ale#test#SetFilename('../test-files/swift/non-swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = 'swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter 'swift-format', ale#Escape('swift-format') . ' lint %t' + +Execute(Should use default command and available configuration when use_swiftpm is not set): + call ale#test#SetDirectory('/testplugin/test/test-files/swift/swift-package-project-with-config') + call ale#test#SetFilename('src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = 'swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter 'swift-format', + \ ale#Escape('swift-format') . ' lint %t ' . '--configuration ' + \ . glob(g:dir . '/.swift-format') + + call ale#test#RestoreDirectory() + +Execute(Should use swift run when use_swiftpm is set to 1): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_use_swiftpm = 1 + + AssertLinter 'swift', ale#Escape('swift') . ' run swift-format lint %t' + +Execute(Should use the provided global executable): + call ale#test#SetFilename('../test-files/swift/swift-package-project/src/folder/dummy.swift') + + let g:ale_swift_appleswiftformat_executable = '/path/to/custom/swift-format' + let g:ale_swift_appleswiftformat_use_swiftpm = 0 + + AssertLinter '/path/to/custom/swift-format', + \ ale#Escape('/path/to/custom/swift-format') . ' lint %t' diff --git a/test/linter/test_swift_swiftformat.vader b/test/linter/test_swift_swiftformat.vader deleted file mode 100644 index 9f6ee62e..00000000 --- a/test/linter/test_swift_swiftformat.vader +++ /dev/null @@ -1,25 +0,0 @@ -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' |