aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-19 11:48:13 +0800
committerGitHub <noreply@github.com>2024-07-19 03:48:13 +0000
commit0b710c8e55930a082e030f980f84bd1e71a29592 (patch)
tree7b226fe651f7a258119ba7466ae67f1bc39c22da
parentf61efe3fe77c9a517dccb9fd5ff7f16c0660ced4 (diff)
downloadrneovim-0b710c8e55930a082e030f980f84bd1e71a29592.tar.gz
rneovim-0b710c8e55930a082e030f980f84bd1e71a29592.tar.bz2
rneovim-0b710c8e55930a082e030f980f84bd1e71a29592.zip
vim-patch:9.1.0599: Termdebug: still get E1023 when specifying arguments (#29794)
Problem: Termdebug: still get E1023 when specifying arguments and using a prompt buffer. Solution: Use empty() instead of len(). Add a test. Fix wrong order of arguments to assert_equal() in Test_termdebug_basic(). (zeertzjq) closes: vim/vim#15288 https://github.com/vim/vim/commit/aef6179bcf04918002103528651996c754c03840
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim2
-rw-r--r--test/old/testdir/test_termdebug.vim28
2 files changed, 21 insertions, 9 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 6227a20e3c..9412a821e8 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -518,7 +518,7 @@ func s:StartDebug_prompt(dict)
call s:SendCommand('set breakpoint pending on')
" Set arguments to be run
- if len(proc_args)
+ if !empty(proc_args)
call s:SendCommand($'set args {join(proc_args)}')
endif
diff --git a/test/old/testdir/test_termdebug.vim b/test/old/testdir/test_termdebug.vim
index bb107161eb..eb88ea6f5f 100644
--- a/test/old/testdir/test_termdebug.vim
+++ b/test/old/testdir/test_termdebug.vim
@@ -124,13 +124,13 @@ func Test_termdebug_basic()
" 60 is approx spaceBuffer * 3
if winwidth(0) <= 78 + 60
Var
- call assert_equal(winnr(), winnr('$'))
- call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]])
+ call assert_equal(winnr('$'), winnr())
+ call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]], winlayout())
let cn += 1
bw!
Asm
- call assert_equal(winnr(), winnr('$'))
- call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]])
+ call assert_equal(winnr('$'), winnr())
+ call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['leaf', 1000], ['leaf', 1003 + cn]]], winlayout())
let cn += 1
bw!
endif
@@ -139,16 +139,16 @@ func Test_termdebug_basic()
let winw = winwidth(0)
Var
if winwidth(0) < winw
- call assert_equal(winnr(), winnr('$') - 1)
- call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]])
+ call assert_equal(winnr('$') - 1, winnr())
+ call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]], winlayout())
let cn += 1
bw!
endif
let winw = winwidth(0)
Asm
if winwidth(0) < winw
- call assert_equal(winnr(), winnr('$') - 1)
- call assert_equal(winlayout(), ['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]])
+ call assert_equal(winnr('$') - 1, winnr())
+ call assert_equal(['col', [['leaf', 1002], ['leaf', 1001], ['row', [['leaf', 1003 + cn], ['leaf', 1000]]]]], winlayout())
let cn += 1
bw!
endif
@@ -161,6 +161,18 @@ func Test_termdebug_basic()
call WaitForAssert({-> assert_equal(1, winnr('$'))})
call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs)
+ for use_prompt in [0, 1]
+ let g:termdebug_config = {}
+ let g:termdebug_config['use_prompt'] = use_prompt
+ TermdebugCommand ./XTD_basic arg args
+ call WaitForAssert({-> assert_equal(3, winnr('$'))})
+ wincmd t
+ quit!
+ redraw!
+ call WaitForAssert({-> assert_equal(1, winnr('$'))})
+ unlet g:termdebug_config
+ endfor
+
call s:cleanup_files(bin_name)
%bw!
endfunc