blob: a1bc0e37f40398908dd21aba4addd1b847ea88f9 [file] [log] [blame]
Bram Moolenaar2a5868a2014-08-16 19:45:02 +02001Tests for Unicode manipulations vim: set ft=vim :
2
3STARTTEST
4:so small.vim
5:set encoding=utf-8
Bram Moolenaar8f08dab2015-11-21 14:31:33 +01006:"
Bram Moolenaar2a5868a2014-08-16 19:45:02 +02007:" Visual block Insert adjusts for multi-byte char
8:new
9:call setline(1, ["aaa", "あああ", "bbb"])
10:exe ":norm! gg0l\<C-V>jjIx\<Esc>"
11:let r = getline(1, '$')
12:
13:bwipeout!
14:$put=r
Bram Moolenaar8f08dab2015-11-21 14:31:33 +010015:"
Bram Moolenaar641e48c2015-06-25 16:09:26 +020016:" Test for built-in function strchars()
17:for str in ["a", "あいa", "A\u20dd", "A\u20dd\u20dd", "\u20dd"]
18: $put=strchars(str)
19: $put=strchars(str, 0)
20: $put=strchars(str, 1)
21:endfor
Bram Moolenaar8f08dab2015-11-21 14:31:33 +010022:"
Bram Moolenaar4f8fa162015-11-19 19:00:05 +010023:" Test for customlist completion
24:function! CustomComplete1(lead, line, pos)
25: return ['あ', 'い']
26:endfunction
Bram Moolenaar8f08dab2015-11-21 14:31:33 +010027:command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo
Bram Moolenaar4f8fa162015-11-19 19:00:05 +010028:call feedkeys(":Test1 \<C-L>'\<C-B>$put='\<CR>", 't')
29:
30:function! CustomComplete2(lead, line, pos)
31: return ['あたし', 'あたま', 'あたりめ']
32:endfunction
Bram Moolenaar8f08dab2015-11-21 14:31:33 +010033:command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo
Bram Moolenaar4f8fa162015-11-19 19:00:05 +010034:call feedkeys(":Test2 \<C-L>'\<C-B>$put='\<CR>", 't')
35:
36:function! CustomComplete3(lead, line, pos)
37: return ['Nこ', 'Nん', 'Nぶ']
38:endfunction
Bram Moolenaar8f08dab2015-11-21 14:31:33 +010039:command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo
Bram Moolenaar4f8fa162015-11-19 19:00:05 +010040:call feedkeys(":Test3 \<C-L>'\<C-B>$put='\<CR>", 't')
41:
Bram Moolenaar2a5868a2014-08-16 19:45:02 +020042:call garbagecollect(1)
43:/^start:/,$wq! test.out
44ENDTEST
45
46start: