summaryrefslogtreecommitdiff
path: root/test/test_should_do_nothing_conditions.vader
blob: 85874e53b31e7778cea8b5c12df694885e4ba7b5 (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
Before:
  Save g:ale_filetype_blacklist
  Save g:ale_maximum_file_size
  Save g:ale_enabled
  Save &l:statusline

  call ale#test#SetDirectory('/testplugin/test')

  let b:funky_command_created = 0

  " We will test for the existence of this command, so create one if needed.
  if !exists(':CtrlPFunky')
    command CtrlPFunky echo
    let b:funky_command_created = 1
  endif

After:
  Restore

  call ale#test#RestoreDirectory()

  if b:funky_command_created
    delcommand CtrlPFunky
    let b:funky_command_created = 0
  endif

  unlet! b:funky_command_created

Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
  Assert !ale#ShouldDoNothing(bufnr('')), 'The preliminary check failed'

  let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* <mru>={%#CtrlPMode1# funky %*}=<fil> <-> %=%<%#CtrlPMode2# %{getcwd()} %*'

  Assert ale#ShouldDoNothing(bufnr(''))

Execute(ALE shouldn't try to check buffers with '.' as the filename):
  AssertEqual
  \ 0,
  \ ale#ShouldDoNothing(bufnr('')),
  \ 'ShouldDoNothing() was 1 for some other reason'

  silent! noautocmd file .

  Assert ale#ShouldDoNothing(bufnr(''))

Execute(The DoNothing check should work if the ALE globals aren't defined):
  unlet! g:ale_filetype_blacklist
  unlet! g:ale_maximum_file_size
  unlet! g:ale_enabled

  " This shouldn't throw exceptions.
  call ale#ShouldDoNothing(bufnr(''))