aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-14 20:54:11 +0800
committerGitHub <noreply@github.com>2023-06-14 20:54:11 +0800
commitbbb934e7755a3b6f14c4d94334b8f54c63daebf1 (patch)
treec65a2455494b81743473539023b77fd2187358c8 /test
parent79a5b89d66db74560e751561542064674e980146 (diff)
downloadrneovim-bbb934e7755a3b6f14c4d94334b8f54c63daebf1.tar.gz
rneovim-bbb934e7755a3b6f14c4d94334b8f54c63daebf1.tar.bz2
rneovim-bbb934e7755a3b6f14c4d94334b8f54c63daebf1.zip
vim-patch:9.0.1629: having utf16idx() rounding up is inconvenient (#24019)
Problem: Having utf16idx() rounding up is inconvenient. Solution: Make utf16idx() round down. (Yegappan Lakshmanan, closes vim/vim#12523) https://github.com/vim/vim/commit/95707037afa1aeae4f3494dc623a721ceed7fc4e Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_functions.vim20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim
index d80004d70f..0fca0e322e 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -1395,14 +1395,14 @@ func Test_utf16idx_from_byteidx()
" UTF-16 index of a string with four byte characters
let str = 'a😊😊b'
call assert_equal(0, utf16idx(str, 0))
- call assert_equal(2, utf16idx(str, 1))
- call assert_equal(2, utf16idx(str, 2))
- call assert_equal(2, utf16idx(str, 3))
- call assert_equal(2, utf16idx(str, 4))
- call assert_equal(4, utf16idx(str, 5))
- call assert_equal(4, utf16idx(str, 6))
- call assert_equal(4, utf16idx(str, 7))
- call assert_equal(4, utf16idx(str, 8))
+ call assert_equal(1, utf16idx(str, 1))
+ call assert_equal(1, utf16idx(str, 2))
+ call assert_equal(1, utf16idx(str, 3))
+ call assert_equal(1, utf16idx(str, 4))
+ call assert_equal(3, utf16idx(str, 5))
+ call assert_equal(3, utf16idx(str, 6))
+ call assert_equal(3, utf16idx(str, 7))
+ call assert_equal(3, utf16idx(str, 8))
call assert_equal(5, utf16idx(str, 9))
call assert_equal(6, utf16idx(str, 10))
call assert_equal(-1, utf16idx(str, 11))
@@ -1498,8 +1498,8 @@ func Test_utf16idx_from_charidx()
" UTF-16 index of a string with four byte characters
let str = "a😊😊b"
call assert_equal(0, utf16idx(str, 0, v:false, v:true))
- call assert_equal(2, utf16idx(str, 1, v:false, v:true))
- call assert_equal(4, utf16idx(str, 2, v:false, v:true))
+ call assert_equal(1, utf16idx(str, 1, v:false, v:true))
+ call assert_equal(3, utf16idx(str, 2, v:false, v:true))
call assert_equal(5, utf16idx(str, 3, v:false, v:true))
call assert_equal(6, utf16idx(str, 4, v:false, v:true))
call assert_equal(-1, utf16idx(str, 5, v:false, v:true))