]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_should_do_nothing_conditions.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / test_should_do_nothing_conditions.vader
1 Before:
2   Save g:ale_filetype_blacklist
3   Save g:ale_maximum_file_size
4   Save g:ale_enabled
5   Save &l:statusline
6
7   let b:fake_mode = 'n'
8
9   call ale#test#SetDirectory('/testplugin/test')
10
11   let b:funky_command_created = 0
12
13   runtime autoload/ale/util.vim
14
15   function! ale#util#Mode(...) abort
16     return b:fake_mode
17   endfunction
18
19   " We will test for the existence of this command, so create one if needed.
20   if !exists(':CtrlPFunky')
21     command CtrlPFunky echo
22     let b:funky_command_created = 1
23   endif
24
25 After:
26   Restore
27
28   call ale#test#RestoreDirectory()
29
30   if b:funky_command_created
31     delcommand CtrlPFunky
32     let b:funky_command_created = 0
33   endif
34
35   unlet! b:funky_command_created
36   unlet! b:fake_mode
37
38   if &diff is 1
39     let &diff = 0
40   endif
41
42   runtime autoload/ale/util.vim
43
44 Given foobar(An empty file):
45 Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
46   Assert !ale#ShouldDoNothing(bufnr('')), 'The preliminary check failed'
47
48   let &l:statusline = '%#CtrlPMode2# prt %*%#CtrlPMode1# line %* <mru>={%#CtrlPMode1# funky %*}=<fil> <-> %=%<%#CtrlPMode2# %{getcwd()} %*'
49
50   Assert ale#ShouldDoNothing(bufnr(''))
51
52 Execute(ALE shouldn't try to check buffers with '.' as the filename):
53   AssertEqual
54   \ 0,
55   \ ale#ShouldDoNothing(bufnr('')),
56   \ 'ShouldDoNothing() was 1 for some other reason'
57
58   silent! noautocmd file .
59
60   Assert ale#ShouldDoNothing(bufnr(''))
61
62 Execute(DoNothing should return 1 when the filetype is empty):
63   AssertEqual
64   \ 0,
65   \ ale#ShouldDoNothing(bufnr('')),
66   \ 'ShouldDoNothing() was 1 for some other reason'
67
68   set filetype=
69
70   AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
71
72 Execute(DoNothing should return 1 when an operator is pending):
73   let b:fake_mode = 'no'
74
75   AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
76
77 Execute(DoNothing should return 1 for diff buffers):
78   let &diff = 1
79
80   AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
81
82 Execute(The DoNothing check should work if the ALE globals aren't defined):
83   unlet! g:ale_filetype_blacklist
84   unlet! g:ale_maximum_file_size
85   unlet! g:ale_enabled
86
87   " This shouldn't throw exceptions.
88   call ale#ShouldDoNothing(bufnr(''))