Add "run to cursor" support
We add a 'temporary' option to line breakpionts and try and clear any temporary breakpionts on the line we end up stopping on. This might not be art, but _probably_ works in almost all cases that matter. it's a bit hacky the way we have to push the reason around, but we don't know where we stopped until we actually get the stack trace response and SetCurrentFrame Move temporary breakpionts to match server response Also delete any existing ones when adding a new one and add tests for run-to-cursor. Only continue after we successfully set the breakpoints. This makes it work in go
This commit is contained in:
parent
0d112d70a0
commit
80985148e7
18 changed files with 693 additions and 205 deletions
|
|
@ -6,38 +6,6 @@ function! ClearDown()
|
|||
call vimspector#test#setup#ClearDown()
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Mappings_Are_Added_HUMAN()
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
endfunction
|
||||
|
||||
function! Test_Mappings_Are_Added_HUMAN()
|
||||
call assert_true( hasmapto( 'vimspector#Continue()' ) )
|
||||
call assert_false( hasmapto( 'vimspector#Launch()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#Stop()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#Restart()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
|
||||
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
|
||||
endfunction
|
||||
|
||||
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
|
||||
call assert_true( hasmapto( 'vimspector#Continue()' ) )
|
||||
call assert_false( hasmapto( 'vimspector#Launch()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#Stop()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#Restart()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
|
||||
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Signs_Placed_Using_API_Are_Shown()
|
||||
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
|
||||
endfunction
|
||||
|
|
@ -78,68 +46,6 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
|
|||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Use_Mappings_HUMAN()
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
endfunction
|
||||
|
||||
function! Test_Use_Mappings_HUMAN()
|
||||
lcd testdata/cpp/simple
|
||||
edit simple.cpp
|
||||
call setpos( '.', [ 0, 15, 1 ] )
|
||||
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
|
||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
||||
|
||||
" Add the breakpoint
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
|
||||
\ 15,
|
||||
\ 'vimspectorBP',
|
||||
\ 9 )
|
||||
|
||||
" Disable the breakpoint
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||
\ 'VimspectorBP',
|
||||
\ 15,
|
||||
\ 'vimspectorBPDisabled',
|
||||
\ 9 )
|
||||
|
||||
" Delete the breakpoint
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
|
||||
|
||||
" Add it again
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||
\ 'VimspectorBP',
|
||||
\ 15,
|
||||
\ 'vimspectorBP',
|
||||
\ 9 )
|
||||
|
||||
" Here we go. Start Debugging
|
||||
call feedkeys( "\<F5>", 'xt' )
|
||||
|
||||
call assert_equal( 2, len( gettabinfo() ) )
|
||||
let cur_tabnr = tabpagenr()
|
||||
call assert_equal( 5, len( gettabinfo( cur_tabnr )[ 0 ].windows ) )
|
||||
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
|
||||
|
||||
" Step
|
||||
call feedkeys( "\<F10>", 'xt' )
|
||||
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
|
||||
call WaitForAssert( {->
|
||||
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
|
||||
\ } )
|
||||
|
||||
call vimspector#test#setup#Reset()
|
||||
|
||||
lcd -
|
||||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_StopAtEntry()
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
endfunction
|
||||
|
|
@ -200,8 +106,8 @@ function Test_DisableBreakpointWhileDebugging()
|
|||
\ 16 )
|
||||
\ } )
|
||||
|
||||
" Add the breakpoint
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call setpos( '.', [ 0, 1, 1 ] )
|
||||
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
|
||||
call WaitForAssert( {->
|
||||
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||
\ 'VimspectorCode',
|
||||
|
|
@ -211,7 +117,6 @@ function Test_DisableBreakpointWhileDebugging()
|
|||
\ } )
|
||||
|
||||
" Run to breakpoint
|
||||
call setpos( '.', [ 0, 15, 1 ] )
|
||||
call feedkeys( "\<F5>", 'xt' )
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
|
||||
call WaitForAssert( {->
|
||||
|
|
@ -258,6 +163,58 @@ function Test_DisableBreakpointWhileDebugging()
|
|||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
function! Test_Add_Breakpoints_In_File_Then_Open()
|
||||
lcd testdata/cpp/simple
|
||||
|
||||
" Set and clear without file open
|
||||
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
|
||||
call vimspector#ClearLineBreakpoint( 'simple.cpp', 16 )
|
||||
|
||||
" Clear non-set breakpoint
|
||||
call vimspector#ClearLineBreakpoint( 'simple.cpp', 1 )
|
||||
|
||||
" Re-add
|
||||
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
|
||||
|
||||
" Open and expect sign to be added
|
||||
edit simple.cpp
|
||||
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
|
||||
\ 16,
|
||||
\ 'vimspectorBP',
|
||||
\ 9 )
|
||||
call vimspector#LaunchWithSettings( { 'configuration': 'run-to-breakpoint' } )
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
|
||||
|
||||
call vimspector#test#setup#Reset()
|
||||
lcd -
|
||||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
function! Test_Add_Breakpoints_In_NonOpenedFile_RunToBreak()
|
||||
lcd testdata/cpp/simple
|
||||
|
||||
" add
|
||||
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
|
||||
|
||||
call vimspector#LaunchWithSettings( {
|
||||
\ 'configuration': 'run-to-breakpoint-specify-file',
|
||||
\ 'prog': 'simple'
|
||||
\ } )
|
||||
call WaitFor( {-> bufexists( 'simple.cpp' ) } )
|
||||
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
|
||||
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
|
||||
|
||||
call vimspector#test#signs#AssertSignAtLine(
|
||||
\ 'VimspectorCode',
|
||||
\ 16,
|
||||
\ 'vimspectorPCBP',
|
||||
\ 200 )
|
||||
|
||||
call vimspector#test#setup#Reset()
|
||||
lcd -
|
||||
%bwipeout!
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Insert_Code_Above_Breakpoint()
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
endfunction
|
||||
|
|
@ -308,7 +265,6 @@ function! Test_Insert_Code_Above_Breakpoint()
|
|||
" Delete it
|
||||
call feedkeys( "\<F9>", 'xt' )
|
||||
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 26 )
|
||||
|
||||
endfunction
|
||||
|
||||
function! SetUp_Test_Conditional_Line_Breakpoint()
|
||||
|
|
@ -360,8 +316,11 @@ function! Test_Conditional_Line_Breakpoint()
|
|||
\ 'vimspectorBP',
|
||||
\ 9 )
|
||||
|
||||
call setpos( '.', [ 0, 17, 1 ] )
|
||||
call vimspector#ToggleBreakpoint( { 'condition': 'argc == 1' } )
|
||||
call setpos( '.', [ 0, 1, 1 ] )
|
||||
call vimspector#SetLineBreakpoint(
|
||||
\ 'simple.cpp',
|
||||
\ 17,
|
||||
\ { 'condition': 'argc == 1' } )
|
||||
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
|
||||
\ 'VimspectorBP',
|
||||
\ 17,
|
||||
|
|
@ -724,7 +683,6 @@ function! Test_Custom_Breakpoint_Priority_Partial()
|
|||
unlet! g:vimspector_sign_priority
|
||||
endfunction
|
||||
|
||||
|
||||
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
|
||||
let moo = 'moo.py'
|
||||
let cow = 'cow.py'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue