@@ -47,7 +47,7 @@ function! ClangFormat(line1, line2, ...) abort
47
47
endfor
48
48
let opt .= " }'"
49
49
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 )
51
51
let result = Chomp (system (cmd))
52
52
if v: shell_error
53
53
throw " Error on system(): clang-format exited with non-zero.\n Command: " . cmd . " \n Output: " . result
@@ -57,10 +57,9 @@ endfunction
57
57
" }}}
58
58
59
59
" 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
62
62
63
- set rtp += ~/.vim/bundle/vim-operator-user
64
63
runtime ! plugin /clang_format.vim
65
64
66
65
call vspec#customize_matcher (' to_be_empty' , function (' empty' ))
@@ -127,7 +126,7 @@ describe 'clang_format#format()'
127
126
before
128
127
let g: clang_format #detect_style_file = 0
129
128
new
130
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
129
+ execute ' silent' ' edit!' ' ./t/test.cpp'
131
130
end
132
131
133
132
after
@@ -169,7 +168,7 @@ describe 'clang_format#format()'
169
168
before
170
169
let g: clang_format #detect_style_file = 0
171
170
new
172
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
171
+ execute ' silent' ' edit!' ' ./t/test.cpp'
173
172
174
173
let s: saved_styles = [g: clang_format #style_options, &expandtab , &shiftwidth ]
175
174
set expandtab
@@ -218,7 +217,7 @@ describe 'clang_format#replace()'
218
217
before
219
218
let g: clang_format #detect_style_file = 0
220
219
new
221
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
220
+ execute ' silent' ' edit!' ' ./t/test.cpp'
222
221
let s: cmd_tmp = g: clang_format #command
223
222
end
224
223
@@ -233,7 +232,7 @@ describe 'clang_format#replace()'
233
232
end
234
233
235
234
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'
237
236
Expect " call clang_format#replace(1, line('$'))" to_throw_exception
238
237
end
239
238
end
@@ -245,7 +244,7 @@ describe '<Plug>(operator-clang-format)'
245
244
before
246
245
let g: clang_format #detect_style_file = 0
247
246
new
248
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
247
+ execute ' silent' ' edit!' ' ./t/test.cpp'
249
248
map x <Plug> (operator-clang-format)
250
249
end
251
250
@@ -288,7 +287,7 @@ describe ':ClangFormat'
288
287
before
289
288
let g: clang_format #detect_style_file = 0
290
289
new
291
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
290
+ execute ' silent' ' edit!' ' ./t/test.cpp'
292
291
end
293
292
294
293
after
@@ -334,7 +333,7 @@ describe ':ClangFormat'
334
333
before
335
334
let g: clang_format #detect_style_file = 0
336
335
new
337
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.js'
336
+ execute ' silent' ' edit!' ' ./t/test.js'
338
337
end
339
338
340
339
after
@@ -358,7 +357,7 @@ describe ':ClangFormat'
358
357
let s: saved_shiftwidth = &shiftwidth
359
358
set noexpandtab shiftwidth = 8
360
359
new
361
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
360
+ execute ' silent' ' edit!' ' ./t/test.cpp'
362
361
end
363
362
364
363
after
@@ -383,7 +382,7 @@ describe 'g:clang_format#auto_format'
383
382
before
384
383
let g: clang_format #auto_format = 1
385
384
new
386
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
385
+ execute ' silent' ' edit!' ' ./t/test.cpp'
387
386
end
388
387
389
388
after
@@ -406,7 +405,7 @@ describe 'g:clang_format#auto_format_on_insert_leave'
406
405
before
407
406
let g: clang_format #auto_format_on_insert_leave = 1
408
407
new
409
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
408
+ execute ' silent' ' edit!' ' ./t/test.cpp'
410
409
end
411
410
412
411
after
@@ -428,7 +427,7 @@ describe 'g:clang_format#auto_formatexpr'
428
427
before
429
428
let g: clang_format #auto_formatexpr = 1
430
429
new
431
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
430
+ execute ' silent' ' edit!' ' ./t/test.cpp'
432
431
end
433
432
434
433
after
@@ -451,7 +450,7 @@ describe 'undo formatting text'
451
450
before
452
451
let g: clang_format #detect_style_file = 0
453
452
new
454
- execute ' silent' ' edit!' ' ./' . s: root_dir . ' t/test.cpp'
453
+ execute ' silent' ' edit!' ' ./t/test.cpp'
455
454
end
456
455
457
456
after
0 commit comments