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.
2 Save g:ale_c_clangformat_executable
3 Save g:c_clangformat_style_option
4 Save g:c_clangformat_use_local_file
6 " Use an invalid global executable, so we don't match it.
7 let g:ale_c_clangformat_executable = 'xxxinvalid'
9 call ale#test#SetDirectory('/testplugin/test/fixers')
15 call ale#test#RestoreDirectory()
17 Execute(The clang-format callback should return the correct default values):
18 call ale#test#SetFilename('../test-files/c/dummy.c')
22 \ 'command': ale#Escape(g:ale_c_clangformat_executable)
23 \ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
25 \ ale#fixers#clangformat#Fix(bufnr(''))
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'
33 \ 'command': ale#Escape(g:ale_c_clangformat_executable)
34 \ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
37 \ ale#fixers#clangformat#Fix(bufnr(''))
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,}'
46 \ 'command': ale#Escape(g:ale_c_clangformat_executable)
47 \ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
48 \ . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'",
50 \ ale#fixers#clangformat#Fix(bufnr(''))
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
60 \ 'command': ale#Escape(g:ale_c_clangformat_executable)
61 \ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
62 \ . ' --some-option' . ' -style=file',
64 \ ale#fixers#clangformat#Fix(bufnr(''))