Wait for sign to be displayed

This commit is contained in:
Ben Jackson 2019-07-24 08:46:09 +01:00
commit 4d484868f3
2 changed files with 25 additions and 11 deletions

View file

@ -124,7 +124,9 @@ function! Test_Use_Mappings_HUMAN()
call feedkeys( "\<F10>", 'xt' ) call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( '%', 16 ) call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
\ } )
call vimspector#test#setup#Reset() call vimspector#test#setup#Reset()
@ -145,7 +147,9 @@ function Test_StopAtEntry()
call feedkeys( "\<F5>", 'xt' ) call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 15 ) call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 15 )
\ } )
call vimspector#test#setup#Reset() call vimspector#test#setup#Reset()
@ -166,7 +170,9 @@ function Test_DisableBreakpointWhileDebugging()
call feedkeys( "\<F5>", 'xt' ) call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 15 ) call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 15 )
\ } )
call vimspector#test#signs#AssertSignGroupEmpty( 'VimspectorBP' ) call vimspector#test#signs#AssertSignGroupEmpty( 'VimspectorBP' )
call setpos( '.', [ 0, 16, 1 ] ) call setpos( '.', [ 0, 16, 1 ] )
@ -200,7 +206,9 @@ function Test_DisableBreakpointWhileDebugging()
call setpos( '.', [ 0, 15, 1 ] ) call setpos( '.', [ 0, 15, 1 ] )
call feedkeys( "\<F5>", 'xt' ) call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 ) call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
\ } )
call vimspector#Reset() call vimspector#Reset()
call WaitForAssert( {-> call WaitForAssert( {->

View file

@ -15,23 +15,29 @@ function! vimspector#test#signs#AssertPCIsAtLineInBuffer( buffer, line ) abort
\ 'group': 'VimspectorCode', \ 'group': 'VimspectorCode',
\ } ) \ } )
call assert_equal( 1, len( signs ), 'Number of buffers named ' . a:buffer ) if assert_equal( 1, len( signs ), 'Number of buffers named ' . a:buffer )
call assert_true( len( signs[ 0 ].signs ) >= 1, return 1
\ 'At least one VimspectorCode sign' ) endif
if assert_true( len( signs[ 0 ].signs ) >= 1,
\ 'At least one VimspectorCode sign' )
return 1
endif
let pc_index = -1 let pc_index = -1
let index = 0 let index = 0
while index < len( signs[ 0 ].signs ) while index < len( signs[ 0 ].signs )
let s = signs[ 0 ].signs[ index ] let s = signs[ 0 ].signs[ index ]
if s.name ==# 'vimspectorPC' if s.name ==# 'vimspectorPC'
call assert_false( pc_index >= 0, 'Too many PC signs' ) if assert_false( pc_index >= 0, 'Too many PC signs' )
return 1
endif
let pc_index = index let pc_index = index
endif endif
let index = index + 1 let index = index + 1
endwhile endwhile
call assert_true( pc_index >= 0 ) return assert_true( pc_index >= 0 ) ||
call assert_equal( a:line, signs[ 0 ].signs[ pc_index ].lnum ) \ assert_equal( a:line, signs[ 0 ].signs[ pc_index ].lnum )
endfunction endfunction
function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group, function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group,