patch 9.1.1052: tests: off-by-one error in CheckCWD in test_debugger.vim
Commit:
https://github.com/vim/vim/commit/3acfbb4b548f4b1659ff1368a1b626cdd263acbe
Author: Yee Cheng Chin <[email protected]>
Date: Sat Jan 25 15:14:06 2025 +0100
patch 9.1.1052: tests: off-by-one error in CheckCWD in test_debugger.vim
Problem: tests: off-by-one error in CheckCWD in test_debugger.vim
Solution: Fix off-by-one in CheckCWD leading to local tests failure
(Yee Cheng Chin)
Vim's test_debugger's Test_debug_backtrace_level test will fail if you
happen to run it in a Vim repository with full path of directory being
exactly 29 characters (e.g. `/Users/bob/developing/src/vim`). The test
does term dump comparison and the printout will overflow if the CWD is
too long. It does have a function to skip to test if it detects that but
it's off by one leading to this one situation where it will fail.
The reason why the logic didn't account for this is that Vim's message
printing will overflow the text if it prints a message at exactly the
width of the terminal. This could be considered a bug / quirk but that
will be another issue.
closes: #16517
Signed-off-by: Yee Cheng Chin <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 4261bb375..2fd68551f 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -8,10 +8,11 @@ CheckRunVimInTerminal
func CheckCWD()
" Check that the longer lines don't wrap due to the length of the script name
- " in cwd
+ " in cwd. Need to subtract by 1 since Vim will still wrap the message if it
+ " just fits.
let script_len = len( getcwd() .. '/Xtest1.vim' )
let longest_line = len( 'Breakpoint in "" line 1' )
- if script_len > ( 75 - longest_line )
+ if script_len > ( 75 - longest_line - 1 )
throw 'Skipped: Your CWD has too many characters'
endif
endfunc
diff --git a/src/version.c b/src/version.c
index 235c4f328..66e9d1079 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1052,
/**/
1051,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1tbhAh-000hz3-E6%40256bit.org.