mirror of
https://github.com/amix/vimrc
synced 2025-07-06 16:05:01 +08:00
Update some plugins.
This commit is contained in:
@ -28,9 +28,18 @@ function! Test_GoDebugStart_Errors() abort
|
||||
|
||||
let l:expected = [
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
|
||||
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
|
||||
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline in argument list; possibly missing comma or )'},
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
|
||||
\]
|
||||
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
|
||||
let l:goversion = split(l:goversion, "\n")[0]
|
||||
if l:goversion < 'go1.19'
|
||||
let expected = [
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
|
||||
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
|
||||
\ ]
|
||||
endif
|
||||
call setqflist([], 'r')
|
||||
|
||||
call assert_false(exists(':GoDebugStop'))
|
||||
|
@ -44,8 +44,8 @@ func! s:gometa(metalinter) abort
|
||||
let actual = copy(getqflist())
|
||||
endwhile
|
||||
|
||||
" sort the results, because golangci-lint seems to be returning the golint
|
||||
" deprecation notice in a non-deterministic order.
|
||||
" sort the results, because golangci-lint doesn't always return notices in
|
||||
" a deterministic order.
|
||||
call sort(l:actual)
|
||||
call sort(l:expected)
|
||||
|
||||
@ -163,8 +163,8 @@ func! s:gometaautosave(metalinter, withList) abort
|
||||
let l:actual = copy(getloclist(0))
|
||||
endwhile
|
||||
|
||||
" sort the results, because golangci-lint seems to be returning the golint
|
||||
" deprecation notice in a non-deterministic order.
|
||||
" sort the results, because golangci-lint doesn't always return notices in
|
||||
" a deterministic order.
|
||||
call sort(l:actual)
|
||||
call sort(l:expected)
|
||||
|
||||
@ -176,48 +176,47 @@ func! s:gometaautosave(metalinter, withList) abort
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func! Test_GometaGolangciLint_importabs() abort
|
||||
call s:gometa_importabs('golangci-lint')
|
||||
endfunc
|
||||
|
||||
func! s:gometa_importabs(metalinter) abort
|
||||
let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
|
||||
silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
|
||||
|
||||
try
|
||||
let g:go_metalinter_command = a:metalinter
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
||||
\ ]
|
||||
" clear the quickfix list
|
||||
call setqflist([], 'r')
|
||||
|
||||
let g:go_metalinter_enabled = ['golint']
|
||||
|
||||
call go#lint#Gometa(0, 0)
|
||||
|
||||
let actual = getqflist()
|
||||
let start = reltime()
|
||||
while len(actual) == 0 && reltimefloat(reltime(start)) < 10
|
||||
sleep 100m
|
||||
let actual = copy(getqflist())
|
||||
endwhile
|
||||
|
||||
" sort the results, because golangci-lint seems to be returning the golint
|
||||
" deprecation notice in a non-deterministic order.
|
||||
call sort(l:actual)
|
||||
call sort(l:expected)
|
||||
|
||||
call gotest#assert_quickfix(actual, expected)
|
||||
finally
|
||||
call call(RestoreGOPATH, [])
|
||||
unlet g:go_metalinter_enabled
|
||||
unlet g:go_metalinter_command
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
"func! Test_GometaGolangciLint_importabs() abort
|
||||
" call s:gometa_importabs('golangci-lint')
|
||||
"endfunc
|
||||
"
|
||||
"func! s:gometa_importabs(metalinter) abort
|
||||
" let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
|
||||
" silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
|
||||
"
|
||||
" try
|
||||
" let g:go_metalinter_command = a:metalinter
|
||||
"
|
||||
" let expected = [
|
||||
" \ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
|
||||
" \ ]
|
||||
" " clear the quickfix list
|
||||
" call setqflist([], 'r')
|
||||
"
|
||||
" let g:go_metalinter_enabled = ['revive', 'typecheck']
|
||||
"
|
||||
" call go#lint#Gometa(0, 0)
|
||||
"
|
||||
" let actual = getqflist()
|
||||
" let start = reltime()
|
||||
" while len(actual) == 0 && reltimefloat(reltime(start)) < 10
|
||||
" sleep 100m
|
||||
" let actual = copy(getqflist())
|
||||
" endwhile
|
||||
"
|
||||
" " sort the results, because golangci-lint doesn't always return notices in
|
||||
" " a deterministic order.
|
||||
" call sort(l:actual)
|
||||
" call sort(l:expected)
|
||||
"
|
||||
" call gotest#assert_quickfix(actual, expected)
|
||||
" finally
|
||||
" call call(RestoreGOPATH, [])
|
||||
" unlet g:go_metalinter_enabled
|
||||
" unlet g:go_metalinter_command
|
||||
" endtry
|
||||
"endfunc
|
||||
"
|
||||
"func! Test_GometaAutoSaveGolangciLint_importabs() abort
|
||||
" call s:gometaautosave_importabs('golangci-lint')
|
||||
"endfunc
|
||||
@ -266,7 +265,6 @@ func! s:gometa_multiple(metalinter) abort
|
||||
try
|
||||
let g:go_metalinter_command = a:metalinter
|
||||
let expected = [
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
||||
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
||||
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
||||
\ ]
|
||||
@ -274,7 +272,7 @@ func! s:gometa_multiple(metalinter) abort
|
||||
" clear the quickfix list
|
||||
call setqflist([], 'r')
|
||||
|
||||
let g:go_metalinter_enabled = ['revive']
|
||||
let g:go_metalinter_enabled = ['revive', 'typecheck']
|
||||
|
||||
call go#lint#Gometa(0, 0)
|
||||
|
||||
@ -285,8 +283,8 @@ func! s:gometa_multiple(metalinter) abort
|
||||
let actual = copy(getqflist())
|
||||
endwhile
|
||||
|
||||
" sort the results, because golangci-lint seems to be returning the golint
|
||||
" deprecation notice in a non-deterministic order.
|
||||
" sort the results, because golangci-lint doesn't always return notices in
|
||||
" a deterministic order.
|
||||
call sort(l:actual)
|
||||
call sort(l:expected)
|
||||
|
||||
@ -309,7 +307,6 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||
try
|
||||
let g:go_metalinter_command = a:metalinter
|
||||
let expected = [
|
||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
||||
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
||||
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
||||
\ ]
|
||||
@ -317,7 +314,7 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||
" clear the location list
|
||||
call setloclist(0, [], 'r')
|
||||
|
||||
let g:go_metalinter_autosave_enabled = ['golint']
|
||||
let g:go_metalinter_autosave_enabled = ['revive', 'typecheck']
|
||||
|
||||
call go#lint#Gometa(0, 1)
|
||||
|
||||
@ -328,8 +325,8 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||
let actual = copy(getloclist(0))
|
||||
endwhile
|
||||
|
||||
" sort the results, because golangci-lint seems to be returning the golint
|
||||
" deprecation notice in a non-deterministic order.
|
||||
" sort the results, because golangci-lint doesn't always return notices in
|
||||
" a deterministic order.
|
||||
call sort(l:actual)
|
||||
call sort(l:expected)
|
||||
|
||||
@ -455,6 +452,7 @@ func! Test_Lint_GOPATH() abort
|
||||
compiler go
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
|
||||
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
||||
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
||||
\ ]
|
||||
@ -492,6 +490,7 @@ func! Test_Lint_NullModule() abort
|
||||
compiler go
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
|
||||
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
||||
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
||||
\ ]
|
||||
|
@ -48,8 +48,16 @@ endfunc
|
||||
|
||||
func! Test_GoTestCompilerError() abort
|
||||
let expected = [
|
||||
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
|
||||
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline in argument list; possibly missing comma or )'}
|
||||
\ ]
|
||||
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
|
||||
let l:goversion = split(l:goversion, "\n")[0]
|
||||
if l:goversion < 'go1.19'
|
||||
let expected = [
|
||||
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
|
||||
\ ]
|
||||
endif
|
||||
|
||||
call s:test('compilerror/compilerror_test.go', expected)
|
||||
endfunc
|
||||
|
||||
|
@ -298,7 +298,21 @@ endfunction
|
||||
" Shelljoin returns a shell-safe string representation of arglist. The
|
||||
" {special} argument of shellescape() may optionally be passed.
|
||||
function! go#util#Shelljoin(arglist, ...) abort
|
||||
" Preserve original shell. This needs to be kept in sync with how s:system
|
||||
" sets shell.
|
||||
let l:shell = &shell
|
||||
|
||||
try
|
||||
if !go#util#IsWin() && executable('/bin/sh')
|
||||
set shell=/bin/sh
|
||||
endif
|
||||
|
||||
if go#util#IsWin()
|
||||
if executable($COMSPEC)
|
||||
let &shell = $COMSPEC
|
||||
endif
|
||||
endif
|
||||
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
if a:0
|
||||
@ -307,20 +321,12 @@ function! go#util#Shelljoin(arglist, ...) abort
|
||||
|
||||
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
|
||||
finally
|
||||
" Restore original values
|
||||
let &shellslash = ssl_save
|
||||
let &shell = l:shell
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
fu! go#util#Shellescape(arg)
|
||||
try
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
return shellescape(a:arg)
|
||||
finally
|
||||
let &shellslash = ssl_save
|
||||
endtry
|
||||
endf
|
||||
|
||||
" Shelllist returns a shell-safe representation of the items in the given
|
||||
" arglist. The {special} argument of shellescape() may optionally be passed.
|
||||
function! go#util#Shelllist(arglist, ...) abort
|
||||
@ -328,9 +334,9 @@ function! go#util#Shelllist(arglist, ...) abort
|
||||
let ssl_save = &shellslash
|
||||
set noshellslash
|
||||
if a:0
|
||||
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
|
||||
return map(copy(a:arglist), 'go#util#Shelljoin(v:val, ' . a:1 . ')')
|
||||
endif
|
||||
return map(copy(a:arglist), 'shellescape(v:val)')
|
||||
return map(copy(a:arglist), 'go#util#Shelljoin(v:val)')
|
||||
finally
|
||||
let &shellslash = ssl_save
|
||||
endtry
|
||||
|
Reference in New Issue
Block a user