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

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / fixers / test_astyle_fixer_callback.vader
1 Before:
2   Save g:ale_c_astyle_executable
3   Save g:ale_c_astyle_project_options
4   Save g:ale_cpp_astyle_project_options
5
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 = ''
11
12   call ale#test#SetDirectory('/testplugin/test/fixers')
13
14 After:
15   Restore
16
17   call ale#test#RestoreDirectory()
18
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('%'))
24
25   AssertEqual
26   \ {
27   \   'command': ale#Escape(g:ale_c_astyle_executable)
28   \     . ' --stdin=' . ale#Escape(targetfile)
29   \ },
30   \ ale#fixers#astyle#Fix(bufnr(''))
31
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('%'))
38
39   AssertEqual
40   \ {
41   \   'command': ale#Escape(g:ale_cpp_astyle_executable)
42   \     . ' --stdin=' . ale#Escape(targetfile)
43   \ },
44   \ ale#fixers#astyle#Fix(bufnr(''))
45
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
51
52   AssertEqual
53   \ {
54   \   'command': ale#Escape('invalidpp')
55   \     . ' --project=' . g:ale_cpp_astyle_project_options
56   \     . ' --stdin=' . ale#Escape(targetfile)
57   \ },
58   \ ale#fixers#astyle#Fix(bufnr(''))
59
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('%'))
64
65   AssertEqual
66   \ {
67   \   'command': ale#Escape('xxxinvalid')
68   \     . ' --project=' . g:ale_c_astyle_project_options
69   \     . ' --stdin=' . ale#Escape(targetfile)
70   \ },
71   \ ale#fixers#astyle#Fix(bufnr(''))
72
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('%'))
76
77   AssertEqual
78   \ {
79   \   'command': ale#Escape('xxxinvalid')
80   \     . ' --project=_astylerc'
81   \     . ' --stdin=' . ale#Escape(targetfile)
82   \ },
83   \ ale#fixers#astyle#Fix(bufnr(''))
84
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('%'))
89
90   AssertEqual
91   \ {
92   \   'command': ale#Escape('invalidpp')
93   \     . ' --project=.astylerc'
94   \     . ' --stdin=' . ale#Escape(targetfile)
95   \ },
96   \ ale#fixers#astyle#Fix(bufnr(''))