Add ClearBreakpoints API
Add a test which actually triggers the mappings and fires up vimspector with the cpptools debugger.
This commit is contained in:
parent
e10a13e758
commit
470c64603a
11 changed files with 155 additions and 19 deletions
|
|
@ -31,6 +31,10 @@ function! Test_Mappings_Are_Added_HUMAN()
|
|||
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()' ) )
|
||||
|
|
@ -49,8 +53,8 @@ endfunction
|
|||
|
||||
function! Test_Signs_Placed_Using_API_Are_Shown()
|
||||
" We need a real file
|
||||
edit testdata/cpp/simple.cpp
|
||||
call feedkeys( '/printf<CR>' )
|
||||
edit testdata/cpp/simple/simple.cpp
|
||||
call feedkeys( "/printf\<CR>", 'x' )
|
||||
|
||||
" Set breakpoint
|
||||
call vimspector#ToggleBreakpoint()
|
||||
|
|
@ -62,9 +66,9 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
|
|||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
|
||||
call assert_true( len( signs ) == 1 )
|
||||
call assert_true( len( signs[ 0 ].signs ) == 1 )
|
||||
call assert_true( signs[ 0 ].signs[ 0 ].name == 'vimspectorBP' )
|
||||
call assert_equal( 1, len( signs ) )
|
||||
call assert_equal( 1, len( signs[ 0 ].signs ) )
|
||||
call assert_equal( 'vimspectorBP', signs[ 0 ].signs[ 0 ].name )
|
||||
|
||||
" Disable breakpoint
|
||||
call vimspector#ToggleBreakpoint()
|
||||
|
|
@ -74,9 +78,9 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
|
|||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
|
||||
call assert_true( len( signs ) == 1 )
|
||||
call assert_true( len( signs[ 0 ].signs ) == 1 )
|
||||
call assert_true( signs[ 0 ].signs[ 0 ].name == 'vimspectorBPDisabled' )
|
||||
call assert_equal( 1, len( signs ) )
|
||||
call assert_equal( 1, len( signs[ 0 ].signs ) )
|
||||
call assert_equal( 'vimspectorBPDisabled', signs[ 0 ].signs[ 0 ].name )
|
||||
|
||||
" Remove breakpoint
|
||||
call vimspector#ToggleBreakpoint()
|
||||
|
|
@ -86,8 +90,76 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
|
|||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
|
||||
call assert_true( len( signs ) == 1 )
|
||||
call assert_true( len( signs[ 0 ].signs ) == 0 )
|
||||
call assert_equal( 1, len( signs ) )
|
||||
call assert_equal( 0, len( signs[ 0 ].signs ) )
|
||||
|
||||
" TODO: Use the screen dump test ?
|
||||
call vimspector#ClearBreakpoints()
|
||||
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
|
||||
|
||||
15
|
||||
call assert_equal( 15, line( '.' ) )
|
||||
|
||||
" Add the breakpoing
|
||||
call feedkeys( "\<F9>", 'x' )
|
||||
|
||||
let signs = sign_getplaced( '.', {
|
||||
\ 'group': 'VimspectorBP',
|
||||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
|
||||
call assert_equal( 1, len( signs ), 1 )
|
||||
call assert_equal( 1, len( signs[ 0 ].signs ), 1 )
|
||||
call assert_equal( 'vimspectorBP', signs[ 0 ].signs[ 0 ].name )
|
||||
|
||||
" Disable the breakpoint
|
||||
call feedkeys( "\<F9>", 'x' )
|
||||
|
||||
let signs = sign_getplaced( '.', {
|
||||
\ 'group': 'VimspectorBP',
|
||||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
call assert_equal( 1, len( signs ), 1 )
|
||||
call assert_equal( 1, len( signs[ 0 ].signs ), 1 )
|
||||
call assert_equal( 'vimspectorBPDisabled', signs[ 0 ].signs[ 0 ].name )
|
||||
|
||||
" Delete the breakpoint
|
||||
call feedkeys( "\<F9>", 'x' )
|
||||
|
||||
let signs = sign_getplaced( '.', {
|
||||
\ 'group': 'VimspectorBP',
|
||||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
call assert_equal( 1, len( signs ), 1 )
|
||||
call assert_equal( 0, len( signs[ 0 ].signs ) )
|
||||
|
||||
" Add it again
|
||||
call feedkeys( "\<F9>", 'x' )
|
||||
|
||||
let signs = sign_getplaced( '.', {
|
||||
\ 'group': 'VimspectorBP',
|
||||
\ 'line': line( '.' )
|
||||
\ } )
|
||||
|
||||
call assert_equal( 1, len( signs ), 1 )
|
||||
call assert_equal( 1, len( signs[ 0 ].signs ), 1 )
|
||||
call assert_equal( 'vimspectorBP', signs[ 0 ].signs[ 0 ].name )
|
||||
|
||||
" Here we go. Start Debugging
|
||||
call feedkeys( "\<F5>", 'x' )
|
||||
|
||||
call vimspector#Reset()
|
||||
|
||||
call vimspector#ClearBreakpoints()
|
||||
|
||||
lcd -
|
||||
bwipeout!
|
||||
endfunction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue