]> git.madduck.net Git - etc/vim.git/blob - test/test_format_temporary_file_creation.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:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / test_format_temporary_file_creation.vader
1 Before:
2   Save g:ale_buffer_info
3   Save g:ale_echo_cursor
4   Save g:ale_enabled
5   Save g:ale_run_synchronously
6   Save g:ale_set_highlights
7   Save g:ale_set_loclist
8   Save g:ale_set_quickfix
9   Save g:ale_set_signs
10
11   " Disable the features we don't need to check.
12   let g:ale_buffer_info = {}
13   let g:ale_echo_cursor = 0
14   let g:ale_enabled = 1
15   let g:ale_run_synchronously = 1
16   unlet! g:ale_run_synchronously_callbacks
17   let g:ale_set_highlights = 0
18   let g:ale_set_loclist = 0
19   let g:ale_set_quickfix = 0
20   let g:ale_set_signs = 0
21
22   let g:output = []
23
24   function! TestCallback(buffer, output)
25     " Extract just letters from the output.
26     let g:output = filter(
27     \ map(a:output, 'matchstr(v:val, ''[a-zA-Z]\+'')'),
28     \ '!empty(v:val)'
29     \)
30
31     return []
32   endfunction
33
34   call ale#linter#PreventLoading('foobar')
35   call ale#linter#Define('foobar', {
36   \ 'name': 'testlinter',
37   \ 'callback': 'TestCallback',
38   \ 'executable': has('win32') ? 'cmd' : 'cat',
39   \ 'command': has('win32') ? 'type %t' : 'cat %t',
40   \})
41
42 After:
43   Restore
44
45   unlet! g:ale_run_synchronously_callbacks
46   unlet! g:output
47   delfunction TestCallback
48
49   call ale#engine#Cleanup(bufnr(''))
50   call ale#linter#Reset()
51
52 Given foobar (Some imaginary filetype):
53   foo
54   bar
55   baz
56
57 Execute(ALE should be able to read the %t file):
58   AssertEqual 'foobar', &filetype
59
60   ALELint
61   call ale#test#FlushJobs()
62
63   AssertEqual ['foo', 'bar', 'baz'], g:output