comparison src/testdir/test_expr_utf8.vim @ 8993:2085167ab1b0 v7.4.1782

commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 23 15:30:09 2016 +0200 patch 7.4.1782 Problem: strcharpart() does not work properly with some multi-byte characters. Solution: Use mb_cptr2len() instead of mb_char2len(). (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sat, 23 Apr 2016 15:45:04 +0200
parents 460c8cc144f0
children 81ba6e4eb72b
comparison
equal deleted inserted replaced
8992:d4e6dccc4840 8993:2085167ab1b0
21 func Test_strcharpart() 21 func Test_strcharpart()
22 call assert_equal('áxb', strcharpart('áxb', 0)) 22 call assert_equal('áxb', strcharpart('áxb', 0))
23 call assert_equal('á', strcharpart('áxb', 0, 1)) 23 call assert_equal('á', strcharpart('áxb', 0, 1))
24 call assert_equal('x', strcharpart('áxb', 1, 1)) 24 call assert_equal('x', strcharpart('áxb', 1, 1))
25 25
26 call assert_equal('いうeお', strcharpart('あいうeお', 1))
27 call assert_equal('い', strcharpart('あいうeお', 1, 1))
28 call assert_equal('いう', strcharpart('あいうeお', 1, 2))
29 call assert_equal('いうe', strcharpart('あいうeお', 1, 3))
30 call assert_equal('いうeお', strcharpart('あいうeお', 1, 4))
31 call assert_equal('eお', strcharpart('あいうeお', 3))
32 call assert_equal('e', strcharpart('あいうeお', 3, 1))
33
34 call assert_equal('あ', strcharpart('あいうeお', -3, 4))
35
26 call assert_equal('a', strcharpart('àxb', 0, 1)) 36 call assert_equal('a', strcharpart('àxb', 0, 1))
27 call assert_equal('̀', strcharpart('àxb', 1, 1)) 37 call assert_equal('̀', strcharpart('àxb', 1, 1))
28 call assert_equal('x', strcharpart('àxb', 2, 1)) 38 call assert_equal('x', strcharpart('àxb', 2, 1))
29 endfunc 39 endfunc