File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -212,3 +212,30 @@ describe ':ClangFormat'
212
212
213
213
end
214
214
" }}}
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
+ " }}}
You can’t perform that action at this time.
0 commit comments