annotate src/testdir/test_iminsert.vim @ 19570:43c04edcafec v8.2.0342

patch 8.2.0342: some code in ex_getln.c not covered by tests Commit: https://github.com/vim/vim/commit/0546d7df13b041833121b2d56036e1c62ea3b0c1 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 1 16:53:09 2020 +0100 patch 8.2.0342: some code in ex_getln.c not covered by tests Problem: Some code in ex_getln.c not covered by tests. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5717)
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Mar 2020 17:00:06 +0100
parents 67eb9bc32434
children f70a3c1000bb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 source view_util.vim
18846
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
2 source check.vim
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let s:imactivatefunc_called = 0
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 let s:imstatusfunc_called = 0
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
6 let s:imstatus_active = 0
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func IM_activatefunc(active)
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let s:imactivatefunc_called = 1
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
10 let s:imstatus_active = a:active
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfunc
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 func IM_statusfunc()
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let s:imstatusfunc_called = 1
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
15 return s:imstatus_active
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_iminsert2()
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
19 let s:imactivatefunc_called = 0
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
20 let s:imstatusfunc_called = 0
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
21
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 set imactivatefunc=IM_activatefunc
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 set imstatusfunc=IM_statusfunc
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 set iminsert=2
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 normal! i
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 set iminsert=0
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 set imactivatefunc=
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 set imstatusfunc=
12936
c53a80f39a52 patch 8.0.1344: using 'imactivatefunc' in the GUI does not work
Christian Brabandt <cb@256bit.org>
parents: 12930
diff changeset
29
c53a80f39a52 patch 8.0.1344: using 'imactivatefunc' in the GUI does not work
Christian Brabandt <cb@256bit.org>
parents: 12930
diff changeset
30 let expected = has('gui_running') ? 0 : 1
c53a80f39a52 patch 8.0.1344: using 'imactivatefunc' in the GUI does not work
Christian Brabandt <cb@256bit.org>
parents: 12930
diff changeset
31 call assert_equal(expected, s:imactivatefunc_called)
c53a80f39a52 patch 8.0.1344: using 'imactivatefunc' in the GUI does not work
Christian Brabandt <cb@256bit.org>
parents: 12930
diff changeset
32 call assert_equal(expected, s:imstatusfunc_called)
12920
327e1264b9bf patch 8.0.1336: cannot use imactivatefunc() unless compiled with +xim
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
34
18846
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
35 func Test_getimstatus()
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
36 if has('win32')
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
37 CheckFeature multi_byte_ime
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
38 elseif !has('gui_mac')
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
39 CheckFeature xim
67eb9bc32434 patch 8.1.2410: MS-Windows: test_iminsert fails without IME support
Bram Moolenaar <Bram@vim.org>
parents: 18008
diff changeset
40 endif
18008
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
41 if has('gui_running')
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
42 if !has('win32')
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
43 throw 'Skipped: running in the GUI, only works on MS-Windows'
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
44 endif
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
45 set imactivatefunc=
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
46 set imstatusfunc=
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
47 else
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
48 set imactivatefunc=IM_activatefunc
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
49 set imstatusfunc=IM_statusfunc
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
50 let s:imstatus_active = 0
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
51 endif
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
52
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
53 new
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
54 set iminsert=2
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
55 call feedkeys("i\<C-R>=getimstatus()\<CR>\<ESC>", 'nx')
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
56 call assert_equal('1', getline(1))
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
57 set iminsert=0
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
58 call feedkeys("o\<C-R>=getimstatus()\<CR>\<ESC>", 'nx')
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
59 call assert_equal('0', getline(2))
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
60 bw!
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
61
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
62 set imactivatefunc=
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
63 set imstatusfunc=
8ae333756614 patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
64 endfunc
19570
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18846
diff changeset
65
43c04edcafec patch 8.2.0342: some code in ex_getln.c not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 18846
diff changeset
66 " vim: shiftwidth=2 sts=2 expandtab