diff options
author | w0rp <devw0rp@gmail.com> | 2020-08-28 14:02:05 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2020-08-28 14:02:05 +0100 |
commit | 34e409ea21baa017776b84ec0620eea9f6ec429c (patch) | |
tree | 46af9d9f297763767e3f5c46c5334df729df3502 /test/test_linter_defintion_processing.vader | |
parent | b8c0ac2e6126d2245f4281c286387b4dd1847178 (diff) | |
download | ale-34e409ea21baa017776b84ec0620eea9f6ec429c.zip |
Close #3285 - lint_file is now dynamic
`lint_file` can now be computed dynamically with a callback function,
which can return a deferred result, as per `ale#command#Run`. This
allows linters to dynamically switch between checking files on disk,
or checking code on the fly.
Some tests have been fixed on Windows.
Diffstat (limited to 'test/test_linter_defintion_processing.vader')
-rw-r--r-- | test/test_linter_defintion_processing.vader | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/test_linter_defintion_processing.vader b/test/test_linter_defintion_processing.vader index 2c85299b..d000b158 100644 --- a/test/test_linter_defintion_processing.vader +++ b/test/test_linter_defintion_processing.vader @@ -174,7 +174,7 @@ Execute(PreProcess should process the lint_file option correctly): \} AssertThrows call ale#linter#PreProcess('testft', g:linter) - AssertEqual '`lint_file` must be `0` or `1`', g:vader_exception + AssertEqual '`lint_file` must be `0`, `1`, or a Function', g:vader_exception let g:linter.lint_file = 0 @@ -185,14 +185,17 @@ Execute(PreProcess should process the lint_file option correctly): let g:linter.lint_file = 1 AssertEqual 1, ale#linter#PreProcess('testft', g:linter).lint_file - " The default for read_buffer should change to 0 when lint_file is 1. - AssertEqual 0, ale#linter#PreProcess('testft', g:linter).read_buffer + " The default for read_buffer should still be 1 + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer let g:linter.read_buffer = 1 - " We shouldn't be able to set both options to 1 at the same time. - AssertThrows call ale#linter#PreProcess('testft', g:linter) - AssertEqual 'Only one of `lint_file` or `read_buffer` can be `1`', g:vader_exception + " We should be able to set `read_buffer` and `lint_file` at the same time. + AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer + + let g:linter.lint_file = function('type') + + Assert type(ale#linter#PreProcess('testft', g:linter).lint_file) is v:t_func Execute(PreProcess should set a default value for lint_file): let g:linter = { |