2018-12-17 06:28:27 -05:00
|
|
|
" don't spam the user when Vim is started in Vi compatibility mode
|
|
|
|
let s:cpo_save = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2018-03-31 10:56:26 -04:00
|
|
|
func! Test_GoTermNewMode()
|
|
|
|
if !has('nvim')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
try
|
|
|
|
let l:filename = 'term/term.go'
|
|
|
|
let l:tmp = gotest#load_fixture(l:filename)
|
|
|
|
exe 'cd ' . l:tmp . '/src/term'
|
|
|
|
|
|
|
|
let expected = expand('%:p')
|
|
|
|
|
|
|
|
let cmd = "go run ". go#util#Shelljoin(go#tool#Files())
|
|
|
|
|
|
|
|
set nosplitright
|
2019-05-17 10:09:13 -04:00
|
|
|
call go#term#new(0, cmd, &errorformat)
|
2018-03-31 10:56:26 -04:00
|
|
|
let actual = expand('%:p')
|
|
|
|
call assert_equal(actual, l:expected)
|
|
|
|
|
|
|
|
finally
|
2019-08-22 11:36:17 -04:00
|
|
|
sleep 50m
|
2018-03-31 10:56:26 -04:00
|
|
|
call delete(l:tmp, 'rf')
|
|
|
|
endtry
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
func! Test_GoTermNewMode_SplitRight()
|
|
|
|
if !has('nvim')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
try
|
|
|
|
let l:filename = 'term/term.go'
|
|
|
|
let l:tmp = gotest#load_fixture(l:filename)
|
|
|
|
exe 'cd ' . l:tmp . '/src/term'
|
|
|
|
|
|
|
|
let expected = expand('%:p')
|
|
|
|
|
|
|
|
let cmd = "go run ". go#util#Shelljoin(go#tool#Files())
|
|
|
|
|
|
|
|
set splitright
|
2019-05-17 10:09:13 -04:00
|
|
|
call go#term#new(0, cmd, &errorformat)
|
2018-03-31 10:56:26 -04:00
|
|
|
let actual = expand('%:p')
|
|
|
|
call assert_equal(actual, l:expected)
|
|
|
|
|
|
|
|
finally
|
2019-08-22 11:36:17 -04:00
|
|
|
sleep 50m
|
2018-03-31 10:56:26 -04:00
|
|
|
call delete(l:tmp, 'rf')
|
|
|
|
set nosplitright
|
|
|
|
endtry
|
|
|
|
endfunc
|
|
|
|
|
2018-12-17 06:28:27 -05:00
|
|
|
" restore Vi compatibility settings
|
|
|
|
let &cpo = s:cpo_save
|
|
|
|
unlet s:cpo_save
|
|
|
|
|
2018-03-31 10:56:26 -04:00
|
|
|
" vim: sw=2 ts=2 et
|