diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixers/test_goofle_java_format_fixer_callback.vader | 27 | ||||
-rw-r--r-- | test/handler/test_ansible_lint_handler.vader | 20 | ||||
-rw-r--r-- | test/handler/test_php_handler.vader | 12 | ||||
-rw-r--r-- | test/test_alelint_autocmd.vader | 9 |
4 files changed, 62 insertions, 6 deletions
diff --git a/test/fixers/test_goofle_java_format_fixer_callback.vader b/test/fixers/test_goofle_java_format_fixer_callback.vader new file mode 100644 index 00000000..d64e2788 --- /dev/null +++ b/test/fixers/test_goofle_java_format_fixer_callback.vader @@ -0,0 +1,27 @@ +Before: + Save g:ale_google_java_format_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_google_java_format_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The google-java-format callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#google_java_format#Fix(bufnr('')) + +Execute(The google-java-format callback should run the command when the executable test passes): + let g:ale_google_java_format_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape(ale_google_java_format_executable) . ' --replace %t' + \ }, + \ ale#fixers#google_java_format#Fix(bufnr('')) diff --git a/test/handler/test_ansible_lint_handler.vader b/test/handler/test_ansible_lint_handler.vader index cd6e513e..796277e6 100644 --- a/test/handler/test_ansible_lint_handler.vader +++ b/test/handler/test_ansible_lint_handler.vader @@ -1,9 +1,13 @@ Before: - runtime ale_linters/ansible/ansible_lint.vim - call ale#test#SetFilename('main.yml') + runtime ale_linters/ansible/ansible_lint.vim + call ale#test#SetFilename('main.yml') + + let b:ale_warn_about_trailing_whitespace = 1 After: - call ale#linter#Reset() + unlet! b:ale_warn_about_trailing_whitespace + + call ale#linter#Reset() Execute(The ansible-lint handler should handle basic errors): AssertEqual @@ -20,6 +24,16 @@ Execute(The ansible-lint handler should handle basic errors): \ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace', \ ]) +Execute(The ansible-lint handler should supress trailing whitespace output when the option is used): + let b:ale_warn_about_trailing_whitespace = 0 + + AssertEqual + \ [ + \ ], + \ ale_linters#ansible#ansible_lint#Handle(bufnr(''), [ + \ fnamemodify(tempname(), ':h') . '/main.yml:35: [EANSIBLE0002] Trailing whitespace', + \ ]) + Execute (The ansible-lint handler should handle names with spaces): AssertEqual \ [ diff --git a/test/handler/test_php_handler.vader b/test/handler/test_php_handler.vader index a6a4ba04..6fe9b323 100644 --- a/test/handler/test_php_handler.vader +++ b/test/handler/test_php_handler.vader @@ -54,6 +54,18 @@ Execute (The php handler should ignore lines starting with 'PHP Parse error'): \ "PHP Parse error: syntax error, This line should be ignored completely in - on line 1", \ ]) +Execute (The php handler should handle lines containing 'Standard input code'): + AssertEqual + \ [ + \ { + \ 'lnum': 47, + \ 'col': 0, + \ 'text': "Invalid numeric literal", + \ }, + \ ], + \ ale_linters#php#php#Handle(347, [ + \ "Parse error: Invalid numeric literal in Standard input code on line 47", + \ ]) Execute (The php handler should parse lines without column indication): AssertEqual \ [ diff --git a/test/test_alelint_autocmd.vader b/test/test_alelint_autocmd.vader index 4503005b..b19e6b4e 100644 --- a/test/test_alelint_autocmd.vader +++ b/test/test_alelint_autocmd.vader @@ -1,5 +1,6 @@ Before: - let g:success = 0 + let g:pre_success = 0 + let g:post_success = 0 let g:ale_run_synchronously = 1 After: @@ -10,9 +11,11 @@ After: Execute (Run a lint cycle, and check that a variable is set in the autocmd): augroup VaderTest autocmd! - autocmd User ALELint let g:success = 1 + autocmd User ALELintPre let g:pre_success = 1 + autocmd User ALELintPost let g:post_success = 1 augroup end call ale#Lint() - AssertEqual g:success, 1 + AssertEqual g:pre_success, 1 + AssertEqual g:post_success, 1 |