summaryrefslogtreecommitdiff
path: root/test/test_linter_defintion_processing.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-02-09 23:32:57 +0000
committerw0rp <devw0rp@gmail.com>2017-02-09 23:32:57 +0000
commit5de445c041432b602c590a175809d89837cdf2b8 (patch)
treea8d281f1bffcd999d876cd500c67687e228c5300 /test/test_linter_defintion_processing.vader
parent9f8c76b5b939c3a73937069dc1c29efeb2eae49f (diff)
downloadale-5de445c041432b602c590a175809d89837cdf2b8.zip
Fix #315 Implement the read_buffer option
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