vim-patch:7.4.1734

Problem:    Test fails when not using utf-8.
Solution:   Split test in regularand utf-8 part.

0f518a8f4d
This commit is contained in:
Michael Ennen
2016-10-23 16:59:24 -07:00
parent d6e27f90b9
commit 763422b036
4 changed files with 35 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ source test_assign.vim
source test_cursor_func.vim
source test_ex_undo.vim
source test_expr.vim
source test_expr_utf8.vim
source test_feedkeys.vim
source test_cmdline.vim
source test_menu.vim

View File

@@ -8,17 +8,6 @@ func Test_strgetchar()
call assert_equal(-1, strgetchar('axb', -1))
call assert_equal(-1, strgetchar('axb', 3))
call assert_equal(-1, strgetchar('', 0))
if !has('multi_byte')
return
endif
call assert_equal(char2nr('á'), strgetchar('áxb', 0))
call assert_equal(char2nr('x'), strgetchar('áxb', 1))
call assert_equal(char2nr('a'), strgetchar('àxb', 0))
call assert_equal(char2nr(''), strgetchar('àxb', 1))
call assert_equal(char2nr('x'), strgetchar('àxb', 2))
endfunc
func Test_strcharpart()
@@ -33,16 +22,4 @@ func Test_strcharpart()
call assert_equal('', strcharpart('axb', -2, 2))
call assert_equal('a', strcharpart('axb', -1, 2))
if !has('multi_byte')
return
endif
call assert_equal('áxb', strcharpart('áxb', 0))
call assert_equal('á', strcharpart('áxb', 0, 1))
call assert_equal('x', strcharpart('áxb', 1, 1))
call assert_equal('a', strcharpart('àxb', 0, 1))
call assert_equal('', strcharpart('àxb', 1, 1))
call assert_equal('x', strcharpart('àxb', 2, 1))
endfunc

View File

@@ -0,0 +1,33 @@
" Tests for expressions using utf-8.
if !has('multi_byte')
finish
endif
scriptencoding utf-8
func Test_strgetchar()
call assert_equal(char2nr('a'), strgetchar('axb', 0))
call assert_equal(char2nr('x'), strgetchar('axb', 1))
call assert_equal(char2nr('b'), strgetchar('axb', 2))
call assert_equal(-1, strgetchar('axb', -1))
call assert_equal(-1, strgetchar('axb', 3))
call assert_equal(-1, strgetchar('', 0))
call assert_equal(char2nr('a'), strgetchar('àxb', 0))
call assert_equal(char2nr('̀'), strgetchar('àxb', 1))
call assert_equal(char2nr('x'), strgetchar('àxb', 2))
call assert_equal(char2nr('あ'), strgetchar('あaい', 0))
call assert_equal(char2nr('a'), strgetchar('あaい', 1))
call assert_equal(char2nr('い'), strgetchar('あaい', 2))
endfunc
func Test_strcharpart()
call assert_equal('áxb', strcharpart('áxb', 0))
call assert_equal('á', strcharpart('áxb', 0, 1))
call assert_equal('x', strcharpart('áxb', 1, 1))
call assert_equal('a', strcharpart('àxb', 0, 1))
call assert_equal('̀', strcharpart('àxb', 1, 1))
call assert_equal('x', strcharpart('àxb', 2, 1))
endfunc

View File

@@ -709,7 +709,7 @@ static int included_patches[] = {
// 1737 NA
// 1736 NA
// 1735,
// 1734,
1734,
// 1733 NA
1732,
// 1731,