diff options
author | toastal <toastal@protonmail.com> | 2020-08-02 23:58:49 +0700 |
---|---|---|
committer | toastal <toastal@protonmail.com> | 2020-08-14 00:31:49 +0700 |
commit | 167e2e77506c55831921ee40dc30c92f7f2aaae8 (patch) | |
tree | c13ac38b07f5d8233fc360fee88c719abf1624fa /test | |
parent | f1080a2bbe701949de16f8b93481375ee5732322 (diff) | |
download | ale-167e2e77506c55831921ee40dc30c92f7f2aaae8.zip |
tests
Diffstat (limited to 'test')
-rw-r--r-- | test/fixers/test_dhall_format_fixer_callback.vader | 27 | ||||
-rw-r--r-- | test/fixers/test_dhall_freeze_fixer_callback.vader | 29 | ||||
-rw-r--r-- | test/fixers/test_dhall_lint_fixer_callback.vader | 27 |
3 files changed, 83 insertions, 0 deletions
diff --git a/test/fixers/test_dhall_format_fixer_callback.vader b/test/fixers/test_dhall_format_fixer_callback.vader new file mode 100644 index 00000000..02873473 --- /dev/null +++ b/test/fixers/test_dhall_format_fixer_callback.vader @@ -0,0 +1,27 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + + call ale#test#SetDirectory('/testplugin/test/dhall') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dhall-format callback should return the correct options): + call ale#test#SetFilename('../dhall_files/testfile.dhall') + + AssertEqual + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' format' + \ . ' --inplace %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#dhall_format#Fix(bufnr('')) diff --git a/test/fixers/test_dhall_freeze_fixer_callback.vader b/test/fixers/test_dhall_freeze_fixer_callback.vader new file mode 100644 index 00000000..6e9650eb --- /dev/null +++ b/test/fixers/test_dhall_freeze_fixer_callback.vader @@ -0,0 +1,29 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + let g:ale_dhall_freeze_options = '--all' + + call ale#test#SetDirectory('/testplugin/test/dhall') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dhall-freeze callback should return the correct options): + call ale#test#SetFilename('../dhall_files/testfile.dhall') + + AssertEqual + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' freeze' + \ . ' --all' + \ . ' --inplace %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#dhall_freeze#Freeze(bufnr('')) diff --git a/test/fixers/test_dhall_lint_fixer_callback.vader b/test/fixers/test_dhall_lint_fixer_callback.vader new file mode 100644 index 00000000..c60b7a73 --- /dev/null +++ b/test/fixers/test_dhall_lint_fixer_callback.vader @@ -0,0 +1,27 @@ +Before: + Save g:ale_dhall_executable + Save g:ale_dhall_options + + " Use an invalid global executable, so we don’t match it. + let g:ale_dhall_executable = 'odd-dhall' + let g:ale_dhall_options = '--ascii' + + call ale#test#SetDirectory('/testplugin/test/dhall') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The dhall-lint callback should return the correct options): + call ale#test#SetFilename('../dhall_files/testfile.dhall') + + AssertEqual + \ { + \ 'command': ale#Escape('odd-dhall') + \ . ' --ascii' + \ . ' lint' + \ . ' --inplace %t', + \ 'read_temporary_file': 1, + \ }, + \ ale#fixers#dhall_lint#Fix(bufnr('')) |