Skip to content

Commit 63e4208

Browse files
committed
fix broken tests for g:clang_format#style_options
1 parent 94da2a1 commit 63e4208

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

t/clang_format_spec.vim

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,35 @@ describe 'clang_format#format()'
165165
Expect pos == getpos('.')
166166
end
167167

168+
describe 'g:clang_format#style_options'
169+
before
170+
let g:clang_format#detect_style_file = 0
171+
new
172+
execute 'silent' 'edit!' './' . s:root_dir . 't/test.cpp'
173+
174+
let s:saved_styles = [g:clang_format#style_options, &expandtab, &shiftwidth]
175+
set expandtab
176+
set shiftwidth=4
177+
end
178+
179+
after
180+
close!
181+
let [g:clang_format#style_options, &expandtab, &shiftwidth] = s:saved_styles
182+
end
183+
184+
it 'customizes code styles'
185+
let g:clang_format#style_options = {'UseTab' : 'false', 'IndentWidth' : 4}
186+
call s:expect_the_same_output(1, line('$'))
187+
end
188+
189+
it 'can contain v:true/v:false'
190+
if exists('v:false')
191+
let g:clang_format#style_options = {'UseTab' : v:false, 'IndentWidth' : 4}
192+
call s:expect_the_same_output(1, line('$'))
193+
endif
194+
end
195+
end
196+
168197
it 'ensures to fix issue #38'
169198
let saved = g:clang_format#style_options
170199
try
@@ -348,37 +377,6 @@ describe ':ClangFormat'
348377
end
349378
" }}}
350379

351-
" test for customizing formatting {{{
352-
describe 'g:clang_format#style_options'
353-
before
354-
let g:clang_format#detect_style_file = 0
355-
new
356-
execute 'silent' 'edit!' './'.s:root_dir.'t/test.cpp'
357-
358-
let s:saved_styles = [g:clang_format#style_options, &expandtab, &shiftwidth]
359-
set expandtab
360-
set shiftwidth=4
361-
end
362-
363-
after
364-
close!
365-
let [g:clang_format#style_options, &expandtab, &shiftwidth] = s:saved_styles
366-
end
367-
368-
it 'customizes code styles'
369-
let g:clang_format#style_options = {'UseTab' : 'false', 'IndentWidth' : 4}
370-
call s:expect_the_same_output(1, line('$'))
371-
end
372-
373-
it 'can contain v:true/v:false'
374-
if exists('v:false')
375-
let g:clang_format#style_options = {'UseTab' : v:false, 'IndentWidth' : 4}
376-
call s:expect_the_same_output(1, line('$'))
377-
endif
378-
end
379-
end
380-
" }}}
381-
382380
" test for auto formatting {{{
383381
describe 'g:clang_format#auto_format'
384382

0 commit comments

Comments
 (0)