]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_floating_preview.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 '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / test_floating_preview.vader
1 Before:
2   let g:ale_floating_preview = 0
3   let g:ale_hover_to_floating_preview = 0
4   let g:ale_detail_to_floating_preview = 0
5
6   runtime autoload/ale/floating_preview.vim
7
8   let g:floated_lines = []
9   let g:floating_preview_show_called = 0
10
11   " Stub out so we can track the call
12   function! ale#floating_preview#Show(lines, ...) abort
13     let g:floating_preview_show_called = 1
14     let g:floated_lines = a:lines
15     return win_getid()
16   endfunction
17
18   let g:ale_buffer_info = {
19   \ bufnr('%'): {
20   \   'loclist': [
21   \     {
22   \       'lnum': 1,
23   \       'col': 10,
24   \       'bufnr': bufnr('%'),
25   \       'vcol': 0,
26   \       'linter_name': 'notalinter',
27   \       'nr': -1,
28   \       'type': 'E',
29   \       'code': 'semi',
30   \       'text': "Missing semicolon.\r",
31   \       'detail': "Every statement should end with a semicolon\nsecond line",
32   \     },
33   \   ],
34   \ }
35   \}
36
37   call ale#linter#Reset()
38   call ale#linter#PreventLoading('javascript')
39
40 After:
41   Restore
42
43   let g:ale_floating_preview = 0
44   let g:ale_hover_to_floating_preview = 0
45   let g:ale_detail_to_floating_preview = 0
46
47   call cursor(1, 1)
48
49   let g:ale_buffer_info = {}
50
51   " Close the preview window if it's open.
52   if &filetype is# 'ale-preview'
53     noautocmd :q!
54   endif
55
56   call ale#linter#Reset()
57
58
59 Given javascript(A file with warnings/errors):
60   var x = 3 + 12345678
61   var x = 5*2 + parseInt("10");
62   // comment
63
64 Execute(Floating preview is used with ALEDetail when g:ale_floating_preview set):
65   let g:ale_floating_preview = 1
66
67   call cursor(1, 10)
68
69   ALEDetail
70
71   let expected = ["Every statement should end with a semicolon", "second line"]
72
73   AssertEqual 1, g:floating_preview_show_called
74   AssertEqual expected, g:floated_lines
75
76 Execute(Floating preview is used with ALEDetail when g:ale_detail_to_floating_preview set):
77   let g:ale_detail_to_floating_preview = 1
78
79   call cursor(1, 10)
80
81   ALEDetail
82
83   let expected = ["Every statement should end with a semicolon", "second line"]
84
85   AssertEqual 1, g:floating_preview_show_called
86   AssertEqual expected, g:floated_lines
87
88 Execute(Floating preview is not used with ALEDetail by default):
89   call cursor(1, 10)
90
91   ALEDetail
92
93   AssertEqual 0, g:floating_preview_show_called