summaryrefslogtreecommitdiff
path: root/test/test_ale_init_au_groups.vader
blob: 05d7888d1991f209f8a8521d1b862ec2b8b5b543 (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
Before:
  function! CheckAutocmd(group)
    call ALEInitAuGroups()
    redir => l:output
      execute 'silent autocmd ' . a:group
    redir END

    return map(
    \ filter(split(l:output, "\n"), 'v:val =~# ''^ALE'''),
    \ 'split(v:val)[1]'
    \)
  endfunction

  Save g:ale_lint_on_text_changed
  Save g:ale_lint_on_insert_leave

After:
  delfunction CheckAutocmd
  Restore

  call ALEInitAuGroups()

Execute (g:ale_lint_on_text_changed = 0 should bind no events):
  let g:ale_lint_on_text_changed = 0

  AssertEqual [], CheckAutocmd('ALERunOnTextChangedGroup')

Execute (g:ale_lint_on_text_changed = 1 bind both events):
  let g:ale_lint_on_text_changed = 1

  AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')

Execute (g:ale_lint_on_text_changed = 'always' should bind both events):
  let g:ale_lint_on_text_changed = 'always'

  AssertEqual ['TextChanged', 'TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')

Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged):
  let g:ale_lint_on_text_changed = 'normal'

  AssertEqual ['TextChanged'], CheckAutocmd('ALERunOnTextChangedGroup')

Execute (g:ale_lint_on_text_changed = 'insert' should bind only TextChangedI):
  let g:ale_lint_on_text_changed = 'insert'

  AssertEqual ['TextChangedI'], CheckAutocmd('ALERunOnTextChangedGroup')

Execute (g:ale_lint_on_insert_leave = 1 should bind InsertLeave):
  let g:ale_lint_on_insert_leave = 1

  AssertEqual ['InsertLeave'], CheckAutocmd('ALERunOnInsertLeave')

Execute (g:ale_lint_on_insert_leave = 0 should bind no events):
  let g:ale_lint_on_insert_leave = 0

  AssertEqual [], CheckAutocmd('ALERunOnInsertLeave')