summaryrefslogtreecommitdiff
path: root/test/smoke_test.vader
blob: 9d0ea3f428ca620d775a2702e560fa63b2939bd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Before:
  function! TestCallback(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': 'TestCallback',
  \ 'executable': 'echo',
  \ 'command': 'echo foo bar',
  \})

After:
  let g:ale_use_ch_sendraw = 0
  let g:ale_buffer_info = {}
  delfunction TestCallback
  call ale#linter#Reset()

Given foobar (Some imaginary filetype):
  foo
  bar
  baz

Execute(Linters should run with the default options):
  AssertEqual 'foobar', &filetype

  call ale#Lint()
  call ale#engine#WaitForJobs(2000)

  AssertEqual [{
  \   'bufnr': bufnr('%'),
  \   'lnum': 2,
  \   'vcol': 0,
  \   'col': 3,
  \   'text': 'foo bar',
  \   'type': 'E',
  \   'nr': -1,
  \   'pattern': '',
  \   'valid': 1,
  \ }], getloclist(0)

Execute(Linters should run with `let g:ale_use_ch_sendraw = 1`):
  AssertEqual 'foobar', &filetype

  let g:ale_use_ch_sendraw = 1

  call ale#Lint()
  call ale#engine#WaitForJobs(2000)

  AssertEqual [{
  \   'bufnr': bufnr('%'),
  \   'lnum': 2,
  \   'vcol': 0,
  \   'col': 3,
  \   'text': 'foo bar',
  \   'type': 'E',
  \   'nr': -1,
  \   'pattern': '',
  \   'valid': 1,
  \ }], getloclist(0)