patch 9.1.0607: termdebug: uses inconsistent style
Problem: termdebug: uses inconsistent style
Solution: termdebug: deprecate numeric values for v:true/false,
fix white space style in the plugin
(Ubaldo Tiberi)
closes: #15304
Signed-off-by: Ubaldo Tiberi <ubaldo.tiberi@google.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_termdebug.vim b/src/testdir/test_termdebug.vim
index ef29151..fe5ed89 100644
--- a/src/testdir/test_termdebug.vim
+++ b/src/testdir/test_termdebug.vim
@@ -160,7 +160,7 @@
call WaitForAssert({-> assert_equal(1, winnr('$'))})
call assert_equal([], sign_getplaced('', #{group: 'TermDebug'})[0].signs)
- for use_prompt in [0, 1]
+ for use_prompt in [v:true, v:false]
let g:termdebug_config = {}
let g:termdebug_config['use_prompt'] = use_prompt
TermdebugCommand ./XTD_basic arg args
@@ -365,7 +365,7 @@
" We want termdebug to overwrite 'K' map but not '+' map.
let g:termdebug_config = {}
- let g:termdebug_config['map_K'] = 1
+ let g:termdebug_config['map_K'] = v:true
Termdebug
call WaitForAssert({-> assert_equal(3, winnr('$'))})
@@ -394,7 +394,7 @@
for key in keys(s:dict)
let s:filename = s:dict[key]
- let g:termdebug_config[key] = 1
+ let g:termdebug_config[key] = v:true
let s:error_message = "You have a file/folder named '" .. s:filename .. "'"
" Write dummy file with bad name
@@ -422,4 +422,49 @@
:%bw!
endfunction
+function Test_termdebug_config_types()
+ " TODO Remove the deprecated features after 1 Jan 2025.
+ let g:termdebug_config = {}
+ let s:error_message = 'Deprecation Warning:'
+ call assert_true(maparg('K', 'n', 0, 1)->empty())
+
+ for key in ['disasm_window', 'variables_window', 'map_K']
+ for val in [0, 1, v:true, v:false]
+ let g:termdebug_config[key] = val
+ Termdebug
+
+ " Type check: warning is displayed
+ if typename(val) == 'number'
+ call WaitForAssert({-> assert_true(execute('messages') =~ s:error_message)})
+ endif
+
+ " Test on g:termdebug_config keys
+ if val && key != 'map_K'
+ call WaitForAssert({-> assert_equal(4, winnr('$'))})
+ call remove(g:termdebug_config, key)
+ else
+ call WaitForAssert({-> assert_equal(3, winnr('$'))})
+ endif
+
+ " Test on mapping
+ if key == 'map_K'
+ if val
+ call assert_equal(':Evaluate<CR>', maparg('K', 'n', 0, 1).rhs)
+ else
+ call assert_true(maparg('K', 'n', 0, 1)->empty())
+ endif
+ endif
+
+ " Shutoff termdebug
+ wincmd t
+ quit!
+ call WaitForAssert({-> assert_equal(1, winnr('$'))})
+ :%bw!
+
+ endfor
+ endfor
+
+ unlet g:termdebug_config
+endfunction
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 2384373..e174c79 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 607,
+/**/
606,
/**/
605,