@@ -47,7 +47,7 @@ function! ClangFormat(line1, line2, ...) abort
4747 endfor
4848 let opt .= " }'"
4949
50- let cmd = printf (' %s %s ./%st /%s --' , g: clang_format #command , opt , s: root_dir , file )
50+ let cmd = printf (' %s %s ./t /%s --' , g: clang_format #command , opt , file )
5151 let result = Chomp (system (cmd))
5252 if v: shell_error
5353 throw " Error on system(): clang-format exited with non-zero.\n Command: " . cmd . " \n Output: " . result
@@ -57,10 +57,9 @@ endfunction
5757" }}}
5858
5959" setup {{{
60- let s: root_dir = ChompHead ( Chomp ( system ( ' git rev-parse --show-cdup ' )) )
61- execute ' set' ' rtp +=./ ' . s: root_dir
60+ let s: root_dir = resolve ( getcwd () . ' /.. ' )
61+ execute ' set' ' rtp +=' . s: root_dir
6262
63- set rtp += ~/.vim/bundle/vim-operator-user
6463runtime ! plugin /clang_format.vim
6564
6665call vspec#customize_matcher (' to_be_empty' , function (' empty' ))
@@ -127,7 +126,7 @@ describe 'clang_format#format()'
127126 before
128127 let g: clang_format #detect_style_file = 0
129128 new
130- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
129+ execute ' silent' ' edit!' ' ./t/test.cpp'
131130 end
132131
133132 after
@@ -169,7 +168,7 @@ describe 'clang_format#format()'
169168 before
170169 let g: clang_format #detect_style_file = 0
171170 new
172- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
171+ execute ' silent' ' edit!' ' ./t/test.cpp'
173172
174173 let s: saved_styles = [g: clang_format #style_options, &expandtab , &shiftwidth ]
175174 set expandtab
@@ -218,7 +217,7 @@ describe 'clang_format#replace()'
218217 before
219218 let g: clang_format #detect_style_file = 0
220219 new
221- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
220+ execute ' silent' ' edit!' ' ./t/test.cpp'
222221 let s: cmd_tmp = g: clang_format #command
223222 end
224223
@@ -233,7 +232,7 @@ describe 'clang_format#replace()'
233232 end
234233
235234 it ' throws an error when command is not found'
236- let g: clang_format #command = ' ./' . s: root_dir . ' t/clang-format-dummy.sh'
235+ let g: clang_format #command = ' ./t/clang-format-dummy.sh'
237236 Expect " call clang_format#replace(1, line('$'))" to_throw_exception
238237 end
239238end
@@ -245,7 +244,7 @@ describe '<Plug>(operator-clang-format)'
245244 before
246245 let g: clang_format #detect_style_file = 0
247246 new
248- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
247+ execute ' silent' ' edit!' ' ./t/test.cpp'
249248 map x <Plug> (operator-clang-format)
250249 end
251250
@@ -288,7 +287,7 @@ describe ':ClangFormat'
288287 before
289288 let g: clang_format #detect_style_file = 0
290289 new
291- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
290+ execute ' silent' ' edit!' ' ./t/test.cpp'
292291 end
293292
294293 after
@@ -334,7 +333,7 @@ describe ':ClangFormat'
334333 before
335334 let g: clang_format #detect_style_file = 0
336335 new
337- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.js'
336+ execute ' silent' ' edit!' ' ./t/test.js'
338337 end
339338
340339 after
@@ -358,7 +357,7 @@ describe ':ClangFormat'
358357 let s: saved_shiftwidth = &shiftwidth
359358 set noexpandtab shiftwidth = 8
360359 new
361- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
360+ execute ' silent' ' edit!' ' ./t/test.cpp'
362361 end
363362
364363 after
@@ -383,7 +382,7 @@ describe 'g:clang_format#auto_format'
383382 before
384383 let g: clang_format #auto_format = 1
385384 new
386- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
385+ execute ' silent' ' edit!' ' ./t/test.cpp'
387386 end
388387
389388 after
@@ -406,7 +405,7 @@ describe 'g:clang_format#auto_format_on_insert_leave'
406405 before
407406 let g: clang_format #auto_format_on_insert_leave = 1
408407 new
409- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
408+ execute ' silent' ' edit!' ' ./t/test.cpp'
410409 end
411410
412411 after
@@ -428,7 +427,7 @@ describe 'g:clang_format#auto_formatexpr'
428427 before
429428 let g: clang_format #auto_formatexpr = 1
430429 new
431- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
430+ execute ' silent' ' edit!' ' ./t/test.cpp'
432431 end
433432
434433 after
@@ -451,7 +450,7 @@ describe 'undo formatting text'
451450 before
452451 let g: clang_format #detect_style_file = 0
453452 new
454- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
453+ execute ' silent' ' edit!' ' ./t/test.cpp'
455454 end
456455
457456 after
0 commit comments