Files
vim-lsp-mirror/test/integration/go/document_formatting.vimspec
Linda_pp 8a39ef5904 Add integration tests with gopls instead of rust-analyzer (#1108)
* Revert "remove flaky integration tests (#1098)"

This reverts commit 78c107085a.

* use gopls for integration tests instead of rust-analyzer

* specific Go and gopls versions via envvar on CI

* remove unused test helper for Rust test project

based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595689580

* include multibyte text in integration test case

based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595690354

* cache gopls binary on running CI workflows

* update doc to run integ tests
2021-03-20 10:54:17 -07:00

41 lines
1.0 KiB
VimL

Describe integration#go#document_formatting
Before
%bwipeout!
if lsp#test#hasproject('go')
call lsp#test#openproject('go', {})
endif
End
After all
%bwipeout!
call lsp#test#closeproject('go')
End
It should correctly format document when using LspDocumentFormatSync
if !lsp#test#hasproject('go')
Skip go project not supported
endif
Assert Equals(lsp#get_server_status('gopls'), 'running')
execute printf('keepalt keepjumps edit %s', lsp#test#projectdir('go') . '/documentformat.go')
let l:original = getline(1, "$")
call execute('LspDocumentFormatSync')
let got = getline(1, "$")
let want = [
\ 'package main',
\ '',
\ 'func main() {',
\ ' print("hello, world!")',
\ ' print("こんにちは、世界")',
\ ' print("a β c")',
\ ' print("δ")',
\ '}'
\ ]
Assert Equals(got, want)
End
End