Skip to content

Commit 58eb654

Browse files
committed
Allow configurable test paths
1 parent d1ecfd4 commit 58eb654

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

plugin/acid.vim

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,32 @@ function! AcidShorthand(callback, shorthand)
3030
exec a:callback s:ret
3131
endfunction
3232

33+
function! s:not_in(path, pattern)
34+
return a:path !~ a:pattern
35+
endfunction
36+
37+
function! s:all_true(pred)
38+
for i in a:pred
39+
if !i
40+
return 0
41+
endif
42+
endfor
43+
endfunction
44+
45+
function! s:path_to_pattern(paths)
46+
return map(a:paths, ".*" . v:val . ".*")
47+
endfunction
48+
3349
function! s:require()
34-
if exists(':AcidRequire') && expand("%r") !~ ".*test.*"
50+
let path = expand("%")
51+
52+
if exists("g:acid_alt_test_paths")
53+
let test_paths = add(g:acid_alt_test_paths, "test")
54+
else
55+
let test_paths = ["test"]
56+
endif
57+
58+
if exists(':AcidRequire') && all_true(not_in(path, path_to_pattern(test_paths)))
3559
AcidRequire
3660
endif
3761
endfunction

0 commit comments

Comments
 (0)