summaryrefslogtreecommitdiff
path: root/test/test_linter_defintion_processing.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_linter_defintion_processing.vader')
-rw-r--r--test/test_linter_defintion_processing.vader49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/test_linter_defintion_processing.vader b/test/test_linter_defintion_processing.vader
index 969a8932..3acc194e 100644
--- a/test/test_linter_defintion_processing.vader
+++ b/test/test_linter_defintion_processing.vader
@@ -234,3 +234,52 @@ Execute(PreProcess should complain when conflicting command options are used):
AssertThrows call ale#linter#PreProcess(g:linter)
AssertEqual 'Only one of `command`, `command_callback`, or `command_chain` should be set', g:vader_exception
+
+Execute(PreProcess should process the read_buffer option correctly):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'callback': 'x',
+ \ 'executable': 'x',
+ \ 'command_chain': [{'callback': 'foo'}, {'callback': 'bar'}],
+ \ 'read_buffer': '0',
+ \}
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual '`read_buffer` must be `0` or `1`', g:vader_exception
+
+ let g:linter.read_buffer = 0
+
+ call ale#linter#PreProcess(g:linter)
+
+ let g:linter.read_buffer = 1
+
+ call ale#linter#PreProcess(g:linter)
+
+ unlet g:linter.read_buffer
+ let g:linter.command_chain[0].read_buffer = '0'
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual 'The `command_chain` item 0 value for `read_buffer` must be `0` or `1`', g:vader_exception
+
+ let g:linter.command_chain[0].read_buffer = 0
+
+ call ale#linter#PreProcess(g:linter)
+
+ let g:linter.command_chain[1].read_buffer = '0'
+
+ AssertThrows call ale#linter#PreProcess(g:linter)
+ AssertEqual 'The `command_chain` item 1 value for `read_buffer` must be `0` or `1`', g:vader_exception
+
+ let g:linter.command_chain[1].read_buffer = 1
+
+ call ale#linter#PreProcess(g:linter)
+
+Execute(PreProcess should set a default value for read_buffer):
+ let g:linter = {
+ \ 'name': 'x',
+ \ 'callback': 'x',
+ \ 'executable': 'x',
+ \ 'command': 'x',
+ \}
+
+ AssertEqual ale#linter#PreProcess(g:linter).read_buffer, 1