forked from vim-test/vim-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgo.vim
More file actions
23 lines (23 loc) · 663 Bytes
/
go.vim
File metadata and controls
23 lines (23 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
let test#go#patterns = {
\ 'test': [
\ '\v^\s*func ((Test|Example).*)\(',
\ '\v^\s*t\.Run\("(.*)"',
\],
\ 'namespace': [
\ '\v^\s*func ((Test).*)\(',
\],
\}
function! test#go#test_file(runner, file_pattern, file) abort
if fnamemodify(a:file, ':t') =~# a:file_pattern
" given the current runner, check if is can be used with the file
if exists('g:test#go#runner')
return a:runner == g:test#go#runner
endif
let contains_ginkgo_import = (search('github.com/onsi/ginkgo', 'n') > 0)
if a:runner ==# 'ginkgo'
return contains_ginkgo_import
else
return !contains_ginkgo_import
endif
endif
endfunction