1 Star 0 Fork 0

dglxlcl/vimspector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
language_python.test.vim 4.62 KB
一键复制 编辑 原始数据 按行查看 历史
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( 'HUMAN' )
endfunction
function! TearDown()
call vimspector#test#setup#TearDown()
endfunction
function! Test_Python_Simple()
let fn='main.py'
lcd ../support/test/python/simple_python
exe 'edit ' . fn
call setpos( '.', [ 0, 6, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 6 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 6,
\ 'vimspectorBP',
\ 9 )
call setpos( '.', [ 0, 1, 1 ] )
" Here we go. Start Debugging
call vimspector#LaunchWithSettings( { 'configuration': 'run' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 7, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 7 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Python_Simple_Adhoc_Config()
let fn='main.py'
lcd ../support/test/python/simple_python
exe 'edit ' . fn
call setpos( '.', [ 0, 6, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 6 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 6,
\ 'vimspectorBP',
\ 9 )
call setpos( '.', [ 0, 1, 1 ] )
" Here we go. Start Debugging
" call vimspector#LaunchWithSettings( { 'configuration': 'run' } )
call vimspector#LaunchWithConfigurations({
\ 'run': {
\ 'adapter': 'debugpy',
\ 'configuration': {
\ 'request': 'launch',
\ 'type': 'python',
\ 'cwd': '${workspaceRoot}',
\ 'program': '${file}',
\ 'stopOnEntry': v:false,
\ 'console': 'integratedTerminal'
\ },
\ 'breakpoints': {
\ 'exception': {
\ 'raised': 'N',
\ 'uncaught': '',
\ 'userUnhandled': ''
\ }
\ }
\ }
\ })
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 7, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 7 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Python_Remote_Attach()
call SkipNeovim()
lcd ../support/test/python/simple_python
let fn='main.py'
exe 'edit ' . fn
let ready = v:false
function! ReceiveFromLauncher( ch, data ) closure
if a:data ==# '*** Launching ***'
let ready = v:true
endif
endfunction
let jobid = job_start( [ './run_with_debugpy' ], {
\ 'out_mode': 'nl',
\ 'out_cb': funcref( 'ReceiveFromLauncher' ),
\ } )
" Wait up to 60s for the debuggee to be launched (the script faffs with
" virtualenvs etc.)
call WaitFor( {-> ready == v:true }, 60000 )
call setpos( '.', [ 0, 6, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 6 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 6,
\ 'vimspectorBP',
\ 9 )
call setpos( '.', [ 0, 1, 1 ] )
" Here we go. Start Debugging (note will wait up to 10s for the script to do
" its virtualenv thing)
call vimspector#LaunchWithSettings( {
\ 'configuration': 'attach',
\ 'port': 5678,
\ 'host': 'localhost'
\ } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 7, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 7 )
\ } )
call vimspector#test#setup#Reset()
call job_stop( jobid )
lcd -
%bwipeout!
endfunction
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dglxlcl/vimspector.git
git@gitee.com:dglxlcl/vimspector.git
dglxlcl
vimspector
vimspector
master

搜索帮助