Skip to content

Commit a50c831

Browse files
arp242bhcleek
authored andcommitted
Add test and fix Exec() call
1 parent 4fe11ea commit a50c831

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

autoload/go/tool_test.vim

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
func! Test_ExecuteInDir() abort
2+
let l:tmp = gotest#write_file('a/a.go', ['package a'])
3+
try
4+
let l:out = go#tool#ExecuteInDir("pwd")
5+
call assert_equal(l:tmp . "/src/a\n", l:out)
6+
finally
7+
call delete(l:tmp, 'rf')
8+
endtry
9+
endfunc
10+
11+
func! Test_ExecuteInDir_nodir() abort
12+
let l:tmp = go#util#tempdir("executeindir")
13+
exe ':e ' . l:tmp . '/new-dir/a'
14+
15+
try
16+
let l:out = go#tool#ExecuteInDir("pwd")
17+
call assert_equal('', l:out)
18+
finally
19+
call delete(l:tmp, 'rf')
20+
endtry
21+
endfunc
22+
23+
" vim: sw=2 ts=2 et

0 commit comments

Comments
 (0)