summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-02-28 09:10:58 +0000
committerw0rp <devw0rp@gmail.com>2017-02-28 09:10:58 +0000
commitceeff6c723463ee4d47159d48b44eb49f8222e91 (patch)
treebc87cf6f502e487dfd7de668b8f9350545e39744 /test
parent31d328b272a6799630457df90f07a07c463128ff (diff)
downloadale-ceeff6c723463ee4d47159d48b44eb49f8222e91.zip
Fix #288 - Add a command for running ALE
Diffstat (limited to 'test')
-rw-r--r--test/test_ale_lint_command.vader61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/test_ale_lint_command.vader b/test/test_ale_lint_command.vader
new file mode 100644
index 00000000..9e70017c
--- /dev/null
+++ b/test/test_ale_lint_command.vader
@@ -0,0 +1,61 @@
+Before:
+ let g:expected_loclist = [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 2,
+ \ 'vcol': 0,
+ \ 'col': 3,
+ \ 'text': 'foo bar',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}]
+ let g:expected_groups = [
+ \ 'ALECleanupGroup',
+ \ 'ALECursorGroup',
+ \ 'ALEHighlightBufferGroup',
+ \ 'ALERunOnEnterGroup',
+ \ 'ALERunOnTextChangedGroup',
+ \]
+
+ function! ToggleTestCallback(buffer, output)
+ return [{
+ \ 'bufnr': a:buffer,
+ \ 'lnum': 2,
+ \ 'vcol': 0,
+ \ 'col': 3,
+ \ 'text': a:output[0],
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \}]
+ endfunction
+
+ call ale#linter#Define('foobar', {
+ \ 'name': 'testlinter',
+ \ 'callback': 'ToggleTestCallback',
+ \ 'executable': 'echo',
+ \ 'command': 'echo foo bar',
+ \})
+
+After:
+ unlet! g:expected_loclist
+ unlet! g:expected_groups
+
+ let g:ale_buffer_info = {}
+ call ale#linter#Reset()
+
+ delfunction ToggleTestCallback
+
+Given foobar (Some imaginary filetype):
+ foo
+ bar
+ baz
+
+Execute(ALELint should run the linters):
+ AssertEqual 'foobar', &filetype
+
+ ALELint
+ call ale#engine#WaitForJobs(2000)
+
+ " Check the loclist
+ AssertEqual g:expected_loclist, getloclist(0)