summaryrefslogtreecommitdiff
path: root/test/test_deferred_command_string.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-02-21 21:24:41 +0000
committerw0rp <devw0rp@gmail.com>2019-02-21 21:24:41 +0000
commitffa45fa3fb44ade28c64aa8f0a21acd71c903a2a (patch)
tree350f4b45b17a1862844a14856c4063c0d219f0bd /test/test_deferred_command_string.vader
parenta8b987a1c31f297622f0038230d23404e7c2ad50 (diff)
downloadale-ffa45fa3fb44ade28c64aa8f0a21acd71c903a2a.zip
#2132 - Implement deferred command handling for linters
Diffstat (limited to 'test/test_deferred_command_string.vader')
-rw-r--r--test/test_deferred_command_string.vader46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/test_deferred_command_string.vader b/test/test_deferred_command_string.vader
new file mode 100644
index 00000000..4d0c8977
--- /dev/null
+++ b/test/test_deferred_command_string.vader
@@ -0,0 +1,46 @@
+Before:
+ Save g:ale_run_synchronously
+ Save g:ale_emulate_job_failure
+ Save g:ale_buffer_info
+
+ let g:ale_run_synchronously = 1
+ let g:ale_buffer_info = {}
+ let b:ale_history = []
+
+ call ale#linter#Reset()
+ call ale#assert#SetUpLinterTestCommands()
+ call ale#linter#Define('foobar', {
+ \ 'name': 'lint_file_linter',
+ \ 'callback': 'LintFileCallback',
+ \ 'executable': 'echo',
+ \ 'command': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})},
+ \ 'read_buffer': 0,
+ \})
+
+After:
+ Restore
+
+ call ale#assert#TearDownLinterTest()
+
+Given foobar (Some imaginary filetype):
+Execute(It should be possible to compute an executable to check based on the result of commands):
+ AssertLinter 'echo', 'foo'
+
+ ALELint
+ call ale#test#FlushJobs()
+
+ AssertEqual
+ \ 1,
+ \ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo'''))
+
+Execute(It handle the deferred command failing):
+ let g:ale_emulate_job_failure = 1
+
+ AssertLinter 'echo', 0
+
+ ALELint
+ call ale#test#FlushJobs()
+
+ AssertEqual
+ \ 0,
+ \ len(filter(copy(b:ale_history), 'string(v:val.command) =~# ''foo'''))