mirror of
https://github.com/vim/vim.git
synced 2025-10-28 09:27:14 -04:00
patch 8.2.0655: search code not sufficiently tested
Problem: Search code not sufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan, closes #5999)
This commit is contained in:
@@ -333,21 +333,24 @@ endfunc
|
||||
|
||||
func Test_motion_if_elif_else_endif()
|
||||
new
|
||||
a
|
||||
/* Test pressing % on #if, #else #elsif and #endif,
|
||||
* with nested #if
|
||||
*/
|
||||
#if FOO
|
||||
/* ... */
|
||||
# if BAR
|
||||
/* ... */
|
||||
# endif
|
||||
#elif BAR
|
||||
/* ... */
|
||||
#else
|
||||
/* ... */
|
||||
#endif
|
||||
.
|
||||
let lines =<< trim END
|
||||
/* Test pressing % on #if, #else #elsif and #endif,
|
||||
* with nested #if
|
||||
*/
|
||||
#if FOO
|
||||
/* ... */
|
||||
# if BAR
|
||||
/* ... */
|
||||
# endif
|
||||
#elif BAR
|
||||
/* ... */
|
||||
#else
|
||||
/* ... */
|
||||
#endif
|
||||
|
||||
#define FOO 1
|
||||
END
|
||||
call setline(1, lines)
|
||||
/#if FOO
|
||||
norm %
|
||||
call assert_equal([9, 1], getpos('.')[1:2])
|
||||
@@ -363,6 +366,30 @@ func Test_motion_if_elif_else_endif()
|
||||
norm $%
|
||||
call assert_equal([6, 1], getpos('.')[1:2])
|
||||
|
||||
" Test for [# and ]# command
|
||||
call cursor(5, 1)
|
||||
normal [#
|
||||
call assert_equal([4, 1], getpos('.')[1:2])
|
||||
call cursor(5, 1)
|
||||
normal ]#
|
||||
call assert_equal([9, 1], getpos('.')[1:2])
|
||||
call cursor(10, 1)
|
||||
normal [#
|
||||
call assert_equal([9, 1], getpos('.')[1:2])
|
||||
call cursor(10, 1)
|
||||
normal ]#
|
||||
call assert_equal([11, 1], getpos('.')[1:2])
|
||||
|
||||
" Finding a match before the first line or after the last line should fail
|
||||
normal gg
|
||||
call assert_beeps('normal [#')
|
||||
normal G
|
||||
call assert_beeps('normal ]#')
|
||||
|
||||
" Finding a match for a macro definition (#define) should fail
|
||||
normal G
|
||||
call assert_beeps('normal %')
|
||||
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
@@ -392,3 +419,5 @@ func Test_motion_c_comment()
|
||||
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user