From c5d6ee940467630b9c14ea0b6917a6b3a94e5f9e Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Sun, 6 Sep 2020 17:09:02 -0700 Subject: [PATCH 1/2] Revert "test: disable highlight tests" This reverts commit 92195505a0577a57713bc4c2ac8e84eeb141fc28. --- autoload/go/highlight_test.vim | 146 ++++++++++++++++----------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/autoload/go/highlight_test.vim b/autoload/go/highlight_test.vim index 77d058fd6d..9360a8f79f 100644 --- a/autoload/go/highlight_test.vim +++ b/autoload/go/highlight_test.vim @@ -270,79 +270,79 @@ function! s:numericHighlightGroupInSliceSlicing(testname, from, to) endtry endfunction -"function! Test_diagnostic_after_fmt() abort -" let g:go_fmt_command = 'gofmt' -" try -" call s:diagnostic_after_write( [ -" \ 'package main', -" \ 'import "fmt"', -" \ '', -" \ 'func main() {', -" \ '', -" \ "\tfmt.Println(\x1fhello)", -" \ '}', -" \ ], []) -" finally -" unlet g:go_fmt_command -" endtry -"endfunction -" -"function! Test_diagnostic_after_fmt_change() abort -" " craft a file that will be changed when it is written (gofmt will change it). -" let g:go_fmt_command = 'gofmt' -" try -" call s:diagnostic_after_write( [ -" \ 'package main', -" \ 'import "fmt"', -" \ '', -" \ 'func main() {', -" \ '', -" \ "fmt.Println(\x1fhello)", -" \ '}', -" \ ], []) -" finally -" unlet g:go_fmt_command -" endtry -"endfunction -" -"function! Test_diagnostic_after_fmt_cleared() abort -" " craft a file that will be fixed when it is written. -" let g:go_fmt_command = 'gofmt' -" try -" call s:diagnostic_after_write( [ -" \ 'package main', -" \ 'import "fmt"', -" \ '', -" \ 'func main() {', -" \ '', -" \ "fmt.Println(\x1fhello)", -" \ '}', -" \ ], ['hello := "hello, vim-go"']) -" finally -" unlet g:go_fmt_command -" endtry -"endfunction -" -"function! Test_diagnostic_after_reload() abort -" let l:dir = gotest#write_file('diagnostic/after-reload.go', [ -" \ 'package main', -" \ 'import "fmt"', -" \ '', -" \ 'func main() {', -" \ '', -" \ "\tfmt.Println(\x1fhello)", -" \ '}', -" \ ]) -" try -" call s:check_diagnostics('', 'goDiagnosticError', 'initial') -" let l:pos = getcurpos() -" edit -" call setpos('.', l:pos) -" call s:check_diagnostics('', 'goDiagnosticError', 'after-reload') -" finally -" call delete(l:dir, 'rf') -" endtry -"endfunction +function! Test_diagnostic_after_fmt() abort + let g:go_fmt_command = 'gofmt' + try + call s:diagnostic_after_write( [ + \ 'package main', + \ 'import "fmt"', + \ '', + \ 'func main() {', + \ '', + \ "\tfmt.Println(\x1fhello)", + \ '}', + \ ], []) + finally + unlet g:go_fmt_command + endtry +endfunction + +function! Test_diagnostic_after_fmt_change() abort + " craft a file that will be changed when its written (gofmt will change it). + let g:go_fmt_command = 'gofmt' + try + call s:diagnostic_after_write( [ + \ 'package main', + \ 'import "fmt"', + \ '', + \ 'func main() {', + \ '', + \ "fmt.Println(\x1fhello)", + \ '}', + \ ], []) + finally + unlet g:go_fmt_command + endtry +endfunction + +function! Test_diagnostic_after_fmt_cleared() abort + " craft a file that will be fixed when it is written. + let g:go_fmt_command = 'gofmt' + try + call s:diagnostic_after_write( [ + \ 'package main', + \ 'import "fmt"', + \ '', + \ 'func main() {', + \ '', + \ "fmt.Println(\x1fhello)", + \ '}', + \ ], ['hello := "hello, vim-go"']) + finally + unlet g:go_fmt_command + endtry +endfunction + +function! Test_diagnostic_after_reload() abort + let l:dir = gotest#write_file('diagnostic/after-reload.go', [ + \ 'package main', + \ 'import "fmt"', + \ '', + \ 'func main() {', + \ '', + \ "\tfmt.Println(\x1fhello)", + \ '}', + \ ]) + try + call s:check_diagnostics('', 'goDiagnosticError', 'initial') + let l:pos = getcurpos() + edit + call setpos('.', l:pos) + call s:check_diagnostics('', 'goDiagnosticError', 'after-reload') + finally + call delete(l:dir, 'rf') + endtry +endfunction function! s:diagnostic_after_write(contents, changes) abort syntax on From fb596329e3a040a466387a0f5d2c2498103b2de8 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Mon, 7 Sep 2020 09:29:28 -0700 Subject: [PATCH 2/2] tests: use empty list for g:go_gopls_options Use an empty list for g:go_gopls_options, because sometime between 2020-08-30 20:07 and 2020-08-31 21:42 some of the tests in highlight_test started failing in GitHub's CI. All attempts to reproduce the failures locally have been unsucessful. By outputting the lsp logs in tests, it became clear that there were some issues with restarting gopls between test runs and turning off the shared client seems to resolve the test failures. --- scripts/runtest.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/runtest.vim b/scripts/runtest.vim index 9567bc7542..3b1672384b 100644 --- a/scripts/runtest.vim +++ b/scripts/runtest.vim @@ -20,6 +20,7 @@ if !exists('g:test_verbose') let g:test_verbose = 0 endif let g:go_echo_command_info = 0 +let g:go_gopls_options = [] function! s:logmessages() abort " Add all messages (usually errors).