0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0549: no test for the 8g8 command

Problem:    No test for the 8g8 command.
Solution:   Add a test. (Dominique Pelle, closes #1615)
This commit is contained in:
Bram Moolenaar
2017-04-07 20:09:51 +02:00
parent d4863aa99e
commit 395b6bab33
2 changed files with 51 additions and 7 deletions

View File

@@ -844,7 +844,7 @@ func! Test_normal18_z_fold()
norm! j norm! j
call assert_equal('52', getline('.')) call assert_equal('52', getline('.'))
" zA on a opened fold when foldenale is not set " zA on a opened fold when foldenable is not set
50 50
set nofoldenable set nofoldenable
norm! zA norm! zA
@@ -906,7 +906,7 @@ func! Test_normal18_z_fold()
norm! j norm! j
call assert_equal('55', getline('.')) call assert_equal('55', getline('.'))
" 2) do not close fold under curser " 2) do not close fold under cursor
51 51
set nofoldenable set nofoldenable
norm! zx norm! zx
@@ -1772,18 +1772,60 @@ fun! Test_normal34_g_cmd3()
if !has("multi_byte") if !has("multi_byte")
return return
endif endif
" Test for g8 " Test for g8
new new
call append(0, 'abcdefghijklmnopqrstuvwxyzäüö') let a=execute(':norm! 1G0g8')
let a=execute(':norm! 1gg$g8') call assert_equal("\nNUL", a)
call assert_equal('c3 b6 ', a[1:])
call setline(1, 'abcdefghijklmnopqrstuvwxyzäüö')
let a=execute(':norm! 1G$g8')
call assert_equal("\nc3 b6 ", a)
call setline(1, "a\u0302")
let a=execute(':norm! 1G0g8')
call assert_equal("\n61 + cc 82 ", a)
" Test for gp gP
call append(1, range(1,10))
" clean up " clean up
bw! bw!
endfunc endfunc
func Test_normal_8g8()
if !has("multi_byte")
return
endif
new
" Test 8g8 which finds invalid utf8 at or after the cursor.
" With invalid byte.
call setline(1, "___\xff___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With invalid byte before the cursor.
call setline(1, "___\xff___")
norm! 1G$h8g8g
call assert_equal([0, 1, 6, 0, 9], getcurpos())
" With truncated sequence.
call setline(1, "___\xE2\x82___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With overlong sequence.
call setline(1, "___\xF0\x82\x82\xAC___")
norm! 1G08g8g
call assert_equal([0, 1, 4, 0, 1], getcurpos())
" With valid utf8.
call setline(1, "café")
norm! 1G08g8
call assert_equal([0, 1, 1, 0, 1], getcurpos())
bw!
endfunc
fun! Test_normal35_g_cmd4() fun! Test_normal35_g_cmd4()
" Test for g< " Test for g<
" Cannot capture its output, " Cannot capture its output,

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
549,
/**/ /**/
548, 548,
/**/ /**/