tool_test.vim 525 B

1234567891011121314151617181920212223
  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. func! Test_ExecuteInDir_nodir() abort
  11. let l:tmp = go#util#tempdir("executeindir")
  12. exe ':e ' . l:tmp . '/new-dir/a'
  13. try
  14. let l:out = go#tool#ExecuteInDir("pwd")
  15. call assert_equal('', l:out)
  16. finally
  17. call delete(l:tmp, 'rf')
  18. endtry
  19. endfunc
  20. " vim: sw=2 ts=2 et