Mercurial > vim
annotate src/testdir/test_utf8.vim @ 10891:c9d057b7a0ab v8.0.0335
patch 8.0.0335: functions test fails
commit https://github.com/vim/vim/commit/507647da3151f7ffccac1b217936240daa79849c
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 17 16:43:49 2017 +0100
patch 8.0.0335: functions test fails
Problem: Functions test fails.
Solution: Use the right buffer number.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 17 Feb 2017 16:45:06 +0100 |
parents | 44a1661f4cfa |
children | 63b02fcf1361 |
rev | line source |
---|---|
10720
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for Unicode manipulations |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 if !has('multi_byte') |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 finish |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 endif |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " Visual block Insert adjusts for multi-byte char |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 func Test_visual_block_insert() |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 new |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call setline(1, ["aaa", "あああ", "bbb"]) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 exe ":norm! gg0l\<C-V>jjIx\<Esc>" |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal(['axaa', 'xあああ', 'bxbb'], getline(1, '$')) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 bwipeout! |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 endfunc |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 " Test for built-in function strchars() |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 func Test_strchars() |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 let inp = ["a", "あいa", "A\u20dd", "A\u20dd\u20dd", "\u20dd"] |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 let exp = [[1, 1, 1], [3, 3, 3], [2, 2, 1], [3, 3, 1], [1, 1, 1]] |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 for i in range(len(inp)) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal(exp[i][0], strchars(inp[i])) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(exp[i][1], strchars(inp[i], 0)) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal(exp[i][2], strchars(inp[i], 1)) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfor |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 endfunc |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 " Test for customlist completion |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 function! CustomComplete1(lead, line, pos) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 return ['あ', 'い'] |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 endfunction |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 function! CustomComplete2(lead, line, pos) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 return ['あたし', 'あたま', 'あたりめ'] |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 endfunction |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 function! CustomComplete3(lead, line, pos) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 return ['Nこ', 'Nん', 'Nぶ'] |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 endfunction |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 func Test_customlist_completion() |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call feedkeys(":Test1 \<C-L>\<C-B>\"\<CR>", 'itx') |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call assert_equal('"Test1 ', getreg(':')) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call feedkeys(":Test2 \<C-L>\<C-B>\"\<CR>", 'itx') |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal('"Test2 あた', getreg(':')) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call feedkeys(":Test3 \<C-L>\<C-B>\"\<CR>", 'itx') |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal('"Test3 N', getreg(':')) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call garbagecollect(1) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 endfunc |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 " Yank one 3 byte character and check the mark columns. |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 func Test_getvcol() |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 new |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call setline(1, "x\u2500x") |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 normal 0lvy |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 call assert_equal(2, col("'[")) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call assert_equal(4, col("']")) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call assert_equal(2, virtcol("'[")) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal(2, virtcol("']")) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 endfunc |