-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgo_test.vim
22 lines (19 loc) · 880 Bytes
/
go_test.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
scriptencoding utf-8
call gopher#init#config()
fun! Test_add_build_tags() abort
" input, g:gopher_build_tags, want
let l:tests = [
\ ['no flags', ['go', 'test'], [], ['go', 'test']],
\ ['add flag', ['go', 'test'], ['x'], ['go', 'test', '-tags', '"x"']],
\ ['merge', ['go', 'test', '-tags', 'y'], ['x'], ['go', 'test', '-tags', '"y x"']],
\ ['add before pkg', ['go', 'test', 'p'], ['x'], ['go', 'test', '-tags', '"x"', 'p']],
\ ['merge before pkg', ['go', 'test', '-tags', 'y', 'p'], ['x'], ['go', 'test', '-tags', '"y x"', 'p']],
\ ]
for l:tt in l:tests
let [l:name, l:in, g:gopher_build_tags, l:want] = l:tt
let l:out = gopher#go#add_build_tags(l:in)
if l:out != l:want
call Errorf("%s failed\nwant: %s\nout: %s", l:name, l:want, l:out)
endif
endfor
endfun