mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 01:00:06 +08:00
fix(string): fix string2chars function test for vim
skip chinese test for old vim
This commit is contained in:
parent
3e1b7fe5b9
commit
f5c6730177
@ -120,7 +120,10 @@ endfunction
|
||||
|
||||
|
||||
" note: this function only works when encoding is utf-8
|
||||
" ref: https://github.com/SpaceVim/SpaceVim/pull/2515
|
||||
" old vim always add ^@ after chinese char.
|
||||
" and it is fixed in 8.1.2269 ~ 8.2.3395
|
||||
" and I do not know which patch fix it.
|
||||
" @bug find the patch for split-\zs
|
||||
function! s:self.string2chars(str) abort
|
||||
let save_enc = &encoding
|
||||
let &encoding = 'utf-8'
|
||||
|
10
test/api/data/chinese_str.vader
Normal file
10
test/api/data/chinese_str.vader
Normal file
@ -0,0 +1,10 @@
|
||||
Execute ( SpaceVim api: data#string ):
|
||||
if !has('patch-8.2.3395')
|
||||
finish
|
||||
endif
|
||||
let str = SpaceVim#api#import('data#string')
|
||||
AssertEqual str.string2chars('你好'), ['你', '好']
|
||||
Log 'test strQ2B()'
|
||||
AssertEqual str.strQ2B('%'), '%'
|
||||
Log 'test strB2Q()'
|
||||
AssertEqual str.strB2Q('%'), '%'
|
@ -31,11 +31,6 @@ Execute ( SpaceVim api: data#string ):
|
||||
AssertEqual str.trim_start(' s b '), 's b '
|
||||
Log 'test string2chars()'
|
||||
AssertEqual str.string2chars(' a b '), [' ', 'a', ' ', 'b', ' ']
|
||||
AssertEqual str.string2chars('你好'), ['你', '好']
|
||||
Log 'test strQ2B()'
|
||||
AssertEqual str.strQ2B('%'), '%'
|
||||
Log 'test strB2Q()'
|
||||
AssertEqual str.strB2Q('%'), '%'
|
||||
AssertEqual str.trim_end(' s b '), ' s b'
|
||||
AssertEqual str.fill_middle('s b', 10), ' s b '
|
||||
AssertEqual str.strAllIndex('hello spacevim hello', 'hello', 0), [[0, 5], [15, 20]]
|
||||
|
Loading…
Reference in New Issue
Block a user