From e0b4df1304472cb44cd262f484806c02d97fced2 Mon Sep 17 00:00:00 2001 From: Billie Cleek Date: Wed, 22 Aug 2018 19:49:41 -0700 Subject: [PATCH] add a test to verify def behavior --- autoload/go/def_test.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/autoload/go/def_test.vim b/autoload/go/def_test.vim index 7e69b12e4b..5a8df6baaf 100644 --- a/autoload/go/def_test.vim +++ b/autoload/go/def_test.vim @@ -34,4 +34,33 @@ func! Test_jump_to_declaration_godef() abort endtry endfunc +func! Test_Jump_leaves_lists() abort + try + let filename = 'def/jump.go' + let l:tmp = gotest#load_fixture(l:filename) + + let expected = [{'lnum': 10, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'quux'}] + + call setloclist(winnr(), copy(expected), 'r' ) + call setqflist(copy(expected), 'r' ) + + let l:bufnr = bufnr('%') + call cursor(6, 3) + call go#def#Jump('') + + let start = reltime() + while bufnr('%') == l:bufnr && reltimefloat(reltime(start)) < 10 + sleep 100m + endwhile + + let actual = getloclist(winnr()) + call gotest#assert_quickfix(actual, expected) + + let actual = getqflist() + call gotest#assert_quickfix(actual, expected) + finally + call delete(l:tmp, 'rf') + endtry +endfunc + " vim: sw=2 ts=2 et