From 167e2e77506c55831921ee40dc30c92f7f2aaae8 Mon Sep 17 00:00:00 2001 From: toastal Date: Sun, 2 Aug 2020 23:58:49 +0700 Subject: tests --- test/fixers/test_dhall_format_fixer_callback.vader | 27 ++++++++++++++++++++ test/fixers/test_dhall_freeze_fixer_callback.vader | 29 ++++++++++++++++++++++ test/fixers/test_dhall_lint_fixer_callback.vader | 27 ++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 test/fixers/test_dhall_format_fixer_callback.vader create mode 100644 test/fixers/test_dhall_freeze_fixer_callback.vader create mode 100644 test/fixers/test_dhall_lint_fixer_callback.vader (limited to 'test/fixers') 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('')) -- cgit v1.2.3 From ed47008710a2295ff3bf2d2e6372ee29cdbe6c39 Mon Sep 17 00:00:00 2001 From: toastal Date: Mon, 14 Sep 2020 09:20:53 +0700 Subject: addressing missing docs + cleaning up older Dhall files --- test/fixers/test_dhall_fixer_callback.vader | 11 ----------- test/fixers/test_dhall_format_fixer_callback.vader | 11 ++++------- test/fixers/test_dhall_freeze_fixer_callback.vader | 13 ++++--------- test/fixers/test_dhall_lint_fixer_callback.vader | 13 ++++--------- 4 files changed, 12 insertions(+), 36 deletions(-) delete mode 100644 test/fixers/test_dhall_fixer_callback.vader (limited to 'test/fixers') diff --git a/test/fixers/test_dhall_fixer_callback.vader b/test/fixers/test_dhall_fixer_callback.vader deleted file mode 100644 index f27880b7..00000000 --- a/test/fixers/test_dhall_fixer_callback.vader +++ /dev/null @@ -1,11 +0,0 @@ -Before: - call ale#assert#SetUpFixerTest('dhall', 'dhall') - -After: - call ale#assert#TearDownFixerTest() - -Execute(The default command should be correct): - AssertFixer - \ { 'read_temporary_file': 1, - \ 'command': ale#Escape('dhall') . ' format --inplace %t' - \ } diff --git a/test/fixers/test_dhall_format_fixer_callback.vader b/test/fixers/test_dhall_format_fixer_callback.vader index 02873473..9bc17f7e 100644 --- a/test/fixers/test_dhall_format_fixer_callback.vader +++ b/test/fixers/test_dhall_format_fixer_callback.vader @@ -6,22 +6,19 @@ Before: let g:ale_dhall_executable = 'odd-dhall' let g:ale_dhall_options = '--ascii' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-format callback should return the correct options): call ale#test#SetFilename('../dhall_files/testfile.dhall') - AssertEqual + AssertFixer \ { \ '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 index 6e9650eb..c8f820bb 100644 --- a/test/fixers/test_dhall_freeze_fixer_callback.vader +++ b/test/fixers/test_dhall_freeze_fixer_callback.vader @@ -7,17 +7,13 @@ Before: let g:ale_dhall_options = '--ascii' let g:ale_dhall_freeze_options = '--all' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-freeze callback should return the correct options): - call ale#test#SetFilename('../dhall_files/testfile.dhall') - - AssertEqual + AssertFixer \ { \ 'command': ale#Escape('odd-dhall') \ . ' --ascii' @@ -25,5 +21,4 @@ Execute(The dhall-freeze callback should return the correct options): \ . ' --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 index c60b7a73..82229363 100644 --- a/test/fixers/test_dhall_lint_fixer_callback.vader +++ b/test/fixers/test_dhall_lint_fixer_callback.vader @@ -6,22 +6,17 @@ Before: let g:ale_dhall_executable = 'odd-dhall' let g:ale_dhall_options = '--ascii' - call ale#test#SetDirectory('/testplugin/test/dhall') + call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint') After: - Restore - - call ale#test#RestoreDirectory() + call ale#assert#TearDownFixerTest() Execute(The dhall-lint callback should return the correct options): - call ale#test#SetFilename('../dhall_files/testfile.dhall') - - AssertEqual + AssertFixer \ { \ 'command': ale#Escape('odd-dhall') \ . ' --ascii' \ . ' lint' \ . ' --inplace %t', \ 'read_temporary_file': 1, - \ }, - \ ale#fixers#dhall_lint#Fix(bufnr('')) + \ } -- cgit v1.2.3