File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,22 @@ func! Test_Format() abort
5858 endtry
5959endfunc
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+
6177func ! Test_Imports () abort
6278 try
6379 let expected = join (readfile (" test-fixtures/lsp/imports/imports_golden.go" ), " \n " )
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import "fmt"
4+ func main () {
5+ fmt .Println ("vim-go" )
6+ }
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ fun! gotest#load_fixture(path) abort
5858
5959 call mkdir (fnamemodify (l: full_path , ' :h' ), ' p' )
6060 call go#util#Chdir (l: dir . ' /src' )
61- silent exe ' noautocmd e ' . a: path
61+ silent exe ' noautocmd e! ' . a: path
6262 silent exe printf (' read %s/test-fixtures/%s' , g: vim_go_root , a: path )
6363 silent noautocmd w !
6464 if go#util#has_job ()
You can’t perform that action at this time.
0 commit comments