adding the first test!

This commit is contained in:
dsych 2021-01-15 00:35:24 -05:00 committed by Ben Jackson
commit 789377eab4
3 changed files with 68 additions and 0 deletions

View file

@ -591,3 +591,67 @@ function! Test_EvaluateFailure()
call vimspector#test#setup#Reset()
%bwipe!
endfunction
function! Test_VariableEval()
let fn = 'testdata/cpp/simple/struct.cpp'
call s:StartDebugging( #{ fn: fn, line: 24, col: 1, launch: #{
\ configuration: 'run-to-breakpoint'
\ } } )
call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 26, 1 )
"evaluate the prev line
" call win_gotoid( g:vimspector_session_windows.code )
call setpos('.', [ 0, 24, 8 ])
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 24, 8 )
call vimspector#ShowTooltip()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '{...}',
\ ' - i: 0',
\ ' - c: 0 ''\\0\{1,3}''',
\ ' - fffff: 0',
\ ' + another_test: ',
\ ],
\ getbufline( winbufnr( g:vimspector_session_windows.eval ),
\ 1,
\ '$' )
\ )
\ } )
" Expand
call win_execute( g:vimspector_session_windows.eval, [
\ 'call feedkeys( ''jjjj'', ''xt'' )',
\ 'call feedkeys( "\<CR>", ''xt'' )'
\ ] )
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '{...}',
\ ' - i: 0',
\ ' - c: 0 ''\\0\{1,3}''',
\ ' - fffff: 0',
\ ' - another_test: ',
\ ' - choo: 0 ''\\0\{1,3}''',
\ ' + ints: '
\ ],
\ getbufline( winbufnr( g:vimspector_session_windows.eval ),
\ 1,
\ '$' )
\ )
\ } )
"Close
call win_execute( g:vimspector_session_windows.eval, 'call feedkeys( "\<Esc>", ''xt'')')
call WaitForAssert( {->
\ assert_equal( 0, g:vimspector_session_windows.eval )
\ } )
call vimspector#test#setup#Reset()
%bwipe!
endfunction