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

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_clangformat_fixer_callback.vader
1 Before:
2   Save g:ale_c_clangformat_executable
3   Save g:c_clangformat_style_option
4   Save g:c_clangformat_use_local_file
5
6   " Use an invalid global executable, so we don't match it.
7   let g:ale_c_clangformat_executable = 'xxxinvalid'
8
9   call ale#test#SetDirectory('/testplugin/test/fixers')
10   let g:dir = getcwd()
11
12 After:
13   Restore
14
15   call ale#test#RestoreDirectory()
16
17 Execute(The clang-format callback should return the correct default values):
18   call ale#test#SetFilename('../test-files/c/dummy.c')
19
20   AssertEqual
21   \ {
22   \   'command': ale#Escape(g:ale_c_clangformat_executable)
23   \     . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
24   \ },
25   \ ale#fixers#clangformat#Fix(bufnr(''))
26
27 Execute(The clangformat callback should include any additional options):
28   call ale#test#SetFilename('../test-files/c/dummy.c')
29   let g:ale_c_clangformat_options = '--some-option'
30
31   AssertEqual
32   \ {
33   \   'command': ale#Escape(g:ale_c_clangformat_executable)
34   \     . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
35   \     . ' --some-option',
36   \ },
37   \ ale#fixers#clangformat#Fix(bufnr(''))
38
39 Execute(The clangformat callback should include style options as well):
40   call ale#test#SetFilename('../test-files/c/dummy.c')
41   let g:ale_c_clangformat_options = '--some-option'
42   let g:ale_c_clangformat_style_option = '{BasedOnStyle: Microsoft, ColumnLimit:80,}'
43
44   AssertEqual
45   \ {
46   \   'command': ale#Escape(g:ale_c_clangformat_executable)
47   \     . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
48   \     . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'",
49   \ },
50   \ ale#fixers#clangformat#Fix(bufnr(''))
51
52 Execute(The clangformat callback should use local file instead of style options):
53   call ale#test#SetFilename('../test-files/clangformat/with_clangformat/dummy.c')
54   let g:ale_c_clangformat_options = '--some-option'
55   let g:ale_c_clangformat_style_option = '{BasedOnStyle: Microsoft, ColumnLimit:80,}'
56   let g:ale_c_clangformat_use_local_file = 1
57
58   AssertEqual
59   \ {
60   \   'command': ale#Escape(g:ale_c_clangformat_executable)
61   \     . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
62   \     . ' --some-option' . ' -style=file',
63   \ },
64   \ ale#fixers#clangformat#Fix(bufnr(''))