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_astyle_executable
3 Save g:ale_c_astyle_project_options
4 Save g:ale_cpp_astyle_project_options
6 " Use an invalid global executable, so we don't match it.
7 let g:ale_c_astyle_executable = 'xxxinvalid'
8 let g:ale_cpp_astyle_executable = 'invalidpp'
9 let g:ale_c_astyle_project_options = ''
10 let g:ale_cpp_astyle_project_options = ''
12 call ale#test#SetDirectory('/testplugin/test/fixers')
17 call ale#test#RestoreDirectory()
19 Execute(The astyle callback should return the correct default values):
20 " Because this file doesn't exist, no astylrc config
21 " exists near it. Therefore, project_options is empty.
22 call ale#test#SetFilename('../c_files/testfile.c')
23 let targetfile = bufname(bufnr('%'))
27 \ 'command': ale#Escape(g:ale_c_astyle_executable)
28 \ . ' --stdin=' . ale#Escape(targetfile)
30 \ ale#fixers#astyle#Fix(bufnr(''))
32 Execute(The astyle callback should support cpp files):
33 " Because this file doesn't exist, no astylrc config
34 " exists near it. Therefore, project_options is empty.
35 call ale#test#SetFilename('../cpp_files/dummy.cpp')
36 set filetype=cpp " The test fails without this
37 let targetfile = bufname(bufnr('%'))
41 \ 'command': ale#Escape(g:ale_cpp_astyle_executable)
42 \ . ' --stdin=' . ale#Escape(targetfile)
44 \ ale#fixers#astyle#Fix(bufnr(''))
46 Execute(The astyle callback should support cpp files with option file set):
47 call ale#test#SetFilename('../cpp_files/dummy.cpp')
48 let g:ale_cpp_astyle_project_options = '.astylerc_cpp'
49 let targetfile = bufname(bufnr('%'))
50 set filetype=cpp " The test fails without this
54 \ 'command': ale#Escape('invalidpp')
55 \ . ' --project=' . g:ale_cpp_astyle_project_options
56 \ . ' --stdin=' . ale#Escape(targetfile)
58 \ ale#fixers#astyle#Fix(bufnr(''))
60 Execute(The astyle callback should return the correct default values with a specified option file):
61 call ale#test#SetFilename('../c_files/testfile.c')
62 let g:ale_c_astyle_project_options = '.astylerc_c'
63 let targetfile = bufname(bufnr('%'))
67 \ 'command': ale#Escape('xxxinvalid')
68 \ . ' --project=' . g:ale_c_astyle_project_options
69 \ . ' --stdin=' . ale#Escape(targetfile)
71 \ ale#fixers#astyle#Fix(bufnr(''))
73 Execute(The astyle callback should find nearest default option file _astylrc):
74 call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.c')
75 let targetfile = bufname(bufnr('%'))
79 \ 'command': ale#Escape('xxxinvalid')
80 \ . ' --project=_astylerc'
81 \ . ' --stdin=' . ale#Escape(targetfile)
83 \ ale#fixers#astyle#Fix(bufnr(''))
85 Execute(The astyle callback should find .astylrc in the same directory as src):
86 call ale#test#SetFilename('../test-files/cpp/dummy.cpp')
87 set filetype=cpp " The test fails without this
88 let targetfile = bufname(bufnr('%'))
92 \ 'command': ale#Escape('invalidpp')
93 \ . ' --project=.astylerc'
94 \ . ' --stdin=' . ale#Escape(targetfile)
96 \ ale#fixers#astyle#Fix(bufnr(''))