Skip to content

Commit ee267fd

Browse files
committed
lsp: add test for single newline insertion
1 parent b891cfa commit ee267fd

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

autoload/go/lsp_test.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ func! Test_Format() abort
5858
endtry
5959
endfunc
6060

61+
func! Test_Format_SingleNewline() abort
62+
try
63+
let expected = join(readfile("test-fixtures/lsp/fmt/format_golden.go"), "\n")
64+
let l:tmp = gotest#load_fixture('lsp/fmt/newline.go')
65+
66+
call go#lsp#Format()
67+
68+
" this should now contain the formatted code
69+
let actual = join(go#util#GetLines(), "\n")
70+
71+
call assert_equal(expected, actual)
72+
finally
73+
call delete(l:tmp, 'rf')
74+
endtry
75+
endfunc
76+
6177
func! Test_Imports() abort
6278
try
6379
let expected = join(readfile("test-fixtures/lsp/imports/imports_golden.go"), "\n")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package main
2+
3+
import "fmt"
4+
func main() {
5+
fmt.Println("vim-go")
6+
}

0 commit comments

Comments
 (0)