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
58
58
endtry
59
59
endfunc
60
60
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
+
61
77
func ! Test_Imports () abort
62
78
try
63
79
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
58
58
59
59
call mkdir (fnamemodify (l: full_path , ' :h' ), ' p' )
60
60
call go#util#Chdir (l: dir . ' /src' )
61
- silent exe ' noautocmd e ' . a: path
61
+ silent exe ' noautocmd e! ' . a: path
62
62
silent exe printf (' read %s/test-fixtures/%s' , g: vim_go_root , a: path )
63
63
silent noautocmd w !
64
64
if go#util#has_job ()
You can’t perform that action at this time.
0 commit comments