fix(normal): fix segfault with bracket command jumping to a mark

vim-patch:9.0.0043: insufficient testing for bracket commands

Problem:    Insufficient testing for bracket commands.
Solution:   Add a few more tests. (closes vim/vim#10668)
cf34434b5e

Cherry-pick a change from patch 8.2.0369.
This commit is contained in:
zeertzjq
2022-07-06 14:40:04 +08:00
parent 8e03d42ec8
commit 1a490a5bc5
2 changed files with 46 additions and 13 deletions

View File

@@ -1422,9 +1422,16 @@ func Test_normal27_bracket()
call assert_equal(5, line('.'))
call assert_equal(3, col('.'))
" No mark after line 21, cursor moves to first non blank on current line
" No mark before line 1, cursor moves to first non-blank on current line
1
norm! 5|['
call assert_equal(' 1 b', getline('.'))
call assert_equal(1, line('.'))
call assert_equal(3, col('.'))
" No mark after line 21, cursor moves to first non-blank on current line
21
norm! $]'
norm! 5|]'
call assert_equal(' 21 b', getline('.'))
call assert_equal(21, line('.'))
call assert_equal(3, col('.'))
@@ -1441,12 +1448,40 @@ func Test_normal27_bracket()
call assert_equal(20, line('.'))
call assert_equal(8, col('.'))
" No mark before line 1, cursor does not move
1
norm! 5|[`
call assert_equal(' 1 b', getline('.'))
call assert_equal(1, line('.'))
call assert_equal(5, col('.'))
" No mark after line 21, cursor does not move
21
norm! 5|]`
call assert_equal(' 21 b', getline('.'))
call assert_equal(21, line('.'))
call assert_equal(5, col('.'))
" Count too large for [`
" cursor moves to first lowercase mark
norm! 99[`
call assert_equal(' 1 b', getline('.'))
call assert_equal(1, line('.'))
call assert_equal(7, col('.'))
" Count too large for ]`
" cursor moves to last lowercase mark
norm! 99]`
call assert_equal(' 20 b', getline('.'))
call assert_equal(20, line('.'))
call assert_equal(8, col('.'))
" clean up
bw!
endfunc
" Test for ( and ) sentence movements
func Test_normal28_parenthesis()
" basic testing for ( and )
new
call append(0, ['This is a test. With some sentences!', '', 'Even with a question? And one more. And no sentence here'])