Skip to content

Commit ef933e6

Browse files
committed
add spec for auto-formatting
but it didn't work and I skipped it...
1 parent fb6341a commit ef933e6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

t/clang_format_spec.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,30 @@ describe ':ClangFormat'
212212

213213
end
214214
" }}}
215+
216+
217+
" test for auto formatting {{{
218+
describe 'g:clang_format#auto_format'
219+
220+
before
221+
let g:clang_format#auto_format = 1
222+
new
223+
execute 'silent' 'edit!' './'.s:root_dir.'t/test.cpp'
224+
end
225+
226+
after
227+
bdelete!
228+
if filereadable('./'.s:root_dir.'t/tmp.cpp')
229+
call delete('./'.s:root_dir.'t/tmp.cpp')
230+
endif
231+
end
232+
233+
it 'formats a current buffer on BufWritePre if the value is 1'
234+
SKIP because somehow BufWritePre event isn't fired
235+
let formatted = clang_format#format(1, line('$'))
236+
doautocmd BufWritePre
237+
let auto_formatted = join(getline(1, line('$')), "\n")
238+
Expect auto_formatted ==# formatted
239+
end
240+
end
241+
" }}}

0 commit comments

Comments
 (0)