Put the cursor at the end of the buffer after evaluations

This commit is contained in:
Ben Jackson 2020-07-18 18:09:25 +01:00
commit e885c95daa
3 changed files with 51 additions and 13 deletions

View file

@ -479,3 +479,46 @@ function! Test_ExpandWatch()
call vimspector#test#setup#Reset()
%bwipe!
endfunction
function Test_EvaluateConsole()
let fn = 'testdata/cpp/simple/struct.cpp'
call s:StartDebugging( #{ fn: fn, line: 24, col: 1, launch: #{
\ configuration: 'run-to-breakpoint'
\ } } )
" Make sure the Test t is initialised
call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 26, 1 )
call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 27, 1 )
VimspectorEval t.i
call assert_equal( bufnr( 'vimspector.Console' ),
\ winbufnr( g:vimspector_session_windows.output ) )
call WaitForAssert( {->
\ assert_equal(
\ [
\ ' Result: 1'
\ ],
\ getbufline( bufnr( 'vimspector.Console' ), '$', '$' )
\ )
\ } )
let len = getbufinfo( 'vimspector.Console' )[ 0 ].linecount
call WaitForAssert( {->
\ assert_equal(
\ [
\ 'Evaluating: t.i',
\ ' Result: 1'
\ ],
\ getbufline( bufnr( 'vimspector.Console' ), len-1, '$' )
\ )
\ } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer(
\ 'vimspector.Console', len, v:null )
call vimspector#test#setup#Reset()
%bwipe!
endfunction