diff options
author | w0rp <w0rp@users.noreply.github.com> | 2017-08-10 21:06:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-10 21:06:55 +0100 |
commit | dcf7cbe3661444b272346f9a3f1a7fd26b97dae3 (patch) | |
tree | f9426e7f53fb3394411ca3618f8fcc2a883b5986 /test | |
parent | 34aa3437e0fc062215020b423bdf57da449e9400 (diff) | |
parent | 4709e676275000f01975aa433f702e825d6a2353 (diff) | |
download | ale-dcf7cbe3661444b272346f9a3f1a7fd26b97dae3.zip |
Merge pull request #842 from gfontenot/gf-swiftformat
Add support for SwiftFormat as a fixer
Diffstat (limited to 'test')
-rw-r--r-- | test/command_callback/swift_paths/dummy.swift | 0 | ||||
-rw-r--r-- | test/fixers/test_swiftformat_fixer_callback.vader | 38 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/command_callback/swift_paths/dummy.swift b/test/command_callback/swift_paths/dummy.swift new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/swift_paths/dummy.swift diff --git a/test/fixers/test_swiftformat_fixer_callback.vader b/test/fixers/test_swiftformat_fixer_callback.vader new file mode 100644 index 00000000..e3674ded --- /dev/null +++ b/test/fixers/test_swiftformat_fixer_callback.vader @@ -0,0 +1,38 @@ +Before: + Save g:ale_swift_swiftformat_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_swift_swiftformat_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + silent cd .. + silent cd command_callback + let g:dir = getcwd() + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The swiftformat callback should return the correct default values): + call ale#test#SetFilename('swift_paths/dummy.swift') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_swiftformat_executable) + \ . ' %t ', + \ }, + \ ale#fixers#swiftformat#Fix(bufnr('')) + +Execute(The swiftformat callback should include any additional options): + call ale#test#SetFilename('swift_paths/dummy.swift') + let g:ale_swift_swiftformat_options = '--some-option' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(g:ale_swift_swiftformat_executable) + \ . ' %t --some-option', + \ }, + \ ale#fixers#swiftformat#Fix(bufnr('')) |