Skip to content

Commit 395b6ba

Browse files
committed
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)
1 parent d4863aa commit 395b6ba

2 files changed

Lines changed: 51 additions & 7 deletions

File tree

src/testdir/test_normal.vim

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ func! Test_normal18_z_fold()
844844
norm! j
845845
call assert_equal('52', getline('.'))
846846

847-
" zA on a opened fold when foldenale is not set
847+
" zA on a opened fold when foldenable is not set
848848
50
849849
set nofoldenable
850850
norm! zA
@@ -906,7 +906,7 @@ func! Test_normal18_z_fold()
906906
norm! j
907907
call assert_equal('55', getline('.'))
908908

909-
" 2) do not close fold under curser
909+
" 2) do not close fold under cursor
910910
51
911911
set nofoldenable
912912
norm! zx
@@ -1772,18 +1772,60 @@ fun! Test_normal34_g_cmd3()
17721772
if !has("multi_byte")
17731773
return
17741774
endif
1775+
17751776
" Test for g8
17761777
new
1777-
call append(0, 'abcdefghijklmnopqrstuvwxyzäüö')
1778-
let a=execute(':norm! 1gg$g8')
1779-
call assert_equal('c3 b6 ', a[1:])
1778+
let a=execute(':norm! 1G0g8')
1779+
call assert_equal("\nNUL", a)
1780+
1781+
call setline(1, 'abcdefghijklmnopqrstuvwxyzäüö')
1782+
let a=execute(':norm! 1G$g8')
1783+
call assert_equal("\nc3 b6 ", a)
1784+
1785+
call setline(1, "a\u0302")
1786+
let a=execute(':norm! 1G0g8')
1787+
call assert_equal("\n61 + cc 82 ", a)
17801788

1781-
" Test for gp gP
1782-
call append(1, range(1,10))
17831789
" clean up
17841790
bw!
17851791
endfunc
17861792

1793+
func Test_normal_8g8()
1794+
if !has("multi_byte")
1795+
return
1796+
endif
1797+
new
1798+
1799+
" Test 8g8 which finds invalid utf8 at or after the cursor.
1800+
1801+
" With invalid byte.
1802+
call setline(1, "___\xff___")
1803+
norm! 1G08g8g
1804+
call assert_equal([0, 1, 4, 0, 1], getcurpos())
1805+
1806+
" With invalid byte before the cursor.
1807+
call setline(1, "___\xff___")
1808+
norm! 1G$h8g8g
1809+
call assert_equal([0, 1, 6, 0, 9], getcurpos())
1810+
1811+
" With truncated sequence.
1812+
call setline(1, "___\xE2\x82___")
1813+
norm! 1G08g8g
1814+
call assert_equal([0, 1, 4, 0, 1], getcurpos())
1815+
1816+
" With overlong sequence.
1817+
call setline(1, "___\xF0\x82\x82\xAC___")
1818+
norm! 1G08g8g
1819+
call assert_equal([0, 1, 4, 0, 1], getcurpos())
1820+
1821+
" With valid utf8.
1822+
call setline(1, "café")
1823+
norm! 1G08g8
1824+
call assert_equal([0, 1, 1, 0, 1], getcurpos())
1825+
1826+
bw!
1827+
endfunc
1828+
17871829
fun! Test_normal35_g_cmd4()
17881830
" Test for g<
17891831
" Cannot capture its output,

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
549,
767769
/**/
768770
548,
769771
/**/

0 commit comments

Comments
 (0)