Skip to content

Commit 0c83815

Browse files
committed
move tests to test/ directory
1 parent f56eb30 commit 0c83815

File tree

11 files changed

+23
-26
lines changed

11 files changed

+23
-26
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ env:
99
install:
1010
- bundle install
1111
- clang-format-${CLANG_VERSION} -version || true
12+
- vim --version
13+
- clang-format --version
1214

1315
script:
14-
- CLANG_FORMAT=clang-format-${CLANG_VERSION} rake ci
16+
- cd test && CLANG_FORMAT=clang-format-${CLANG_VERSION} rake test
1517

1618
addons:
1719
apt:

Gemfile renamed to test/Gemfile

File renamed without changes.
File renamed without changes.

Guardfile renamed to test/Guardfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# encoding: utf-8
22

3-
require 'terminal-notifier'
4-
53
def which cmd
64
dir = ENV['PATH'].split(':').find {|p| File.executable? File.join(p, cmd)}
75
File.join(dir, cmd) unless dir.nil?
@@ -20,7 +18,7 @@ def notify m
2018
end
2119

2220
guard :shell do
23-
watch /^(autoload|plugin|t)\/.+\.vim$/ do
21+
watch /^(\.\.\/autoload|plugin|t)\/.+\.vim$/ do
2422
system "rake test"
2523
unless $?
2624
notify "test(s) failed"

Rakefile renamed to test/Rakefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
task :ci => [:dump, :test]
2-
3-
task :dump do
4-
sh 'vim --version'
5-
end
6-
71
task :test do
82
sh 'bundle install'
93
sh 'bundle exec vim-flavor test'
104
end
5+
6+
task :watch do
7+
sh 'guard -w ..'
8+
end
File renamed without changes.
File renamed without changes.
File renamed without changes.

t/clang_format_spec.vim renamed to test/t/clang_format_spec.vim

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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.\nCommand: " . cmd . "\nOutput: " . 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
6463
runtime! plugin/clang_format.vim
6564

6665
call 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
239238
end
@@ -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
File renamed without changes.

0 commit comments

Comments
 (0)