diff options
author | Michael Ennen <mike.ennen@gmail.com> | 2016-10-23 16:59:24 -0700 |
---|---|---|
committer | Michael Ennen <mike.ennen@gmail.com> | 2016-10-23 18:04:46 -0700 |
commit | 763422b0365cd9270dc495f31e75e75913516088 (patch) | |
tree | 81cf9c4c48f9fa7cbeddca3245c1fab82e2e0cc8 | |
parent | d6e27f90b9ce19852d14e74c9e8a883f6c2207d7 (diff) | |
download | rneovim-763422b0365cd9270dc495f31e75e75913516088.tar.gz rneovim-763422b0365cd9270dc495f31e75e75913516088.tar.bz2 rneovim-763422b0365cd9270dc495f31e75e75913516088.zip |
vim-patch:7.4.1734
Problem: Test fails when not using utf-8.
Solution: Split test in regularand utf-8 part.
https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
-rw-r--r-- | src/nvim/testdir/test_alot.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_expr.vim | 23 | ||||
-rw-r--r-- | src/nvim/testdir/test_expr_utf8.vim | 33 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 35 insertions, 24 deletions
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 90194fefce..87c1cd2c58 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -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 diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim index 5c70dcb25e..7ea4ebc7df 100644 --- a/src/nvim/testdir/test_expr.vim +++ b/src/nvim/testdir/test_expr.vim @@ -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 diff --git a/src/nvim/testdir/test_expr_utf8.vim b/src/nvim/testdir/test_expr_utf8.vim new file mode 100644 index 0000000000..85cddbb13a --- /dev/null +++ b/src/nvim/testdir/test_expr_utf8.vim @@ -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 diff --git a/src/nvim/version.c b/src/nvim/version.c index 74e9289a3e..cdbc0a34fe 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -709,7 +709,7 @@ static int included_patches[] = { // 1737 NA // 1736 NA // 1735, - // 1734, + 1734, // 1733 NA 1732, // 1731, |