annotate src/testdir/test_menu.vim @ 25022:39551b6e0112 v8.2.3048

patch 8.2.3048: strange error for white space after ++ command Commit: https://github.com/vim/vim/commit/22480d147fe83cb31316d2dabc5c5f249477af15 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 25 21:31:09 2021 +0200 patch 8.2.3048: strange error for white space after ++ command Problem: Strange error for white space after ++ command. Solution: Check for white space explicitly. (closes https://github.com/vim/vim/issues/8440)
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Jun 2021 21:45:03 +0200
parents b545334ae654
children 6f615b2fdc66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7488
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test that the system menu can be loaded.
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature menu
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
5
7488
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_load_menu()
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 try
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 source $VIMRUNTIME/menu.vim
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 catch
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 11048
diff changeset
10 call assert_report('error while loading menus: ' . v:exception)
7488
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endtry
11048
860d023f0fc8 patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents: 11046
diff changeset
12 call assert_match('browse confirm w', execute(':menu File.Save'))
18860
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
13
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
14 let v:errmsg = ''
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
15 doautocmd LoadBufferMenu VimEnter
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
16 call assert_equal('', v:errmsg)
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
17
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
18 source $VIMRUNTIME/delmenu.vim
18860
ec92ccff5c8b patch 8.1.2416: loading menus sets v:errmsg
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
19 call assert_equal('', v:errmsg)
7488
6f14d7da2d8a commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 endfunc
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
21
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
22 func Test_buffer_menu_special_buffers()
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
23 " Load in runtime menus
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
24 try
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
25 source $VIMRUNTIME/menu.vim
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
26 catch
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
27 call assert_report('error while loading menus: ' . v:exception)
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
28 endtry
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
29
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
30 let v:errmsg = ''
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
31 doautocmd LoadBufferMenu VimEnter
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
32 call assert_equal('', v:errmsg)
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
33
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
34 let orig_buffer_menus = execute("nmenu Buffers")
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
35
19844
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
36 " Test that regular new buffer results in a new buffer menu item.
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
37 new
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
38 let new_buffer_menus = execute('nmenu Buffers')
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
39 call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(new_buffer_menus, "\n")))
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
40 bwipe!
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
41 call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
42
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
43 " Make a new command-line window, test that it does not create a new buffer
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
44 " menu.
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
45 call feedkeys("q::let cmdline_buffer_menus=execute('nmenu Buffers')\<CR>:q\<CR>", 'ntx')
19844
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
46 call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(cmdline_buffer_menus, "\n")))
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
47 call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
48
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
49 if has('terminal')
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
50 " Open a terminal window and test that it does not create a buffer menu
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
51 " item.
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
52 terminal
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
53 let term_buffer_menus = execute('nmenu Buffers')
19844
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
54 call assert_equal(len(split(orig_buffer_menus, "\n")) + 2, len(split(term_buffer_menus, "\n")))
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
55 bwipe!
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
56 call assert_equal(orig_buffer_menus, execute("nmenu Buffers"))
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
57 endif
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
58
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
59 " Remove menus to clean up
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
60 source $VIMRUNTIME/delmenu.vim
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
61 call assert_equal('', v:errmsg)
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
62 endfunc
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
63
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
64 func Test_translate_menu()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
65 CheckFeature multi_lang
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
66 if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim')
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
67 throw 'Skipped: translated menu not found'
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
68 endif
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
69
11048
860d023f0fc8 patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents: 11046
diff changeset
70 " First delete any English menus.
860d023f0fc8 patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents: 11046
diff changeset
71 source $VIMRUNTIME/delmenu.vim
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
72 set langmenu=de_de
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
73 source $VIMRUNTIME/menu.vim
11046
d48f4eeb91ec patch 8.0.0412: menu test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11044
diff changeset
74 call assert_match('browse confirm w', execute(':menu Datei.Speichern'))
11044
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
75
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
76 source $VIMRUNTIME/delmenu.vim
eb3a2ff3309a patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents: 7488
diff changeset
77 endfunc
14952
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
78
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
79 func Test_menu_commands()
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
80 nmenu 2 Test.FooBar :let g:did_menu = 'normal'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
81 vmenu 2 Test.FooBar :let g:did_menu = 'visual'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
82 smenu 2 Test.FooBar :let g:did_menu = 'select'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
83 omenu 2 Test.FooBar :let g:did_menu = 'op-pending'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
84 tlmenu 2 Test.FooBar :let g:did_menu = 'terminal'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
85 imenu 2 Test.FooBar :let g:did_menu = 'insert'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
86 cmenu 2 Test.FooBar :let g:did_menu = 'cmdline'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
87 emenu n Test.FooBar
18977
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18860
diff changeset
88
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18860
diff changeset
89 call feedkeys(":menu Test.FooB\<C-A>\<C-B>\"\<CR>", 'tx')
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18860
diff changeset
90 call assert_equal('"menu Test.FooBar', @:)
5bef1043abff patch 8.2.0049: command line completion not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18860
diff changeset
91
14952
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
92 call assert_equal('normal', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
93 emenu v Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
94 call assert_equal('visual', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
95 emenu s Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
96 call assert_equal('select', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
97 emenu o Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
98 call assert_equal('op-pending', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
99 emenu t Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
100 call assert_equal('terminal', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
101 emenu i Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
102 call assert_equal('insert', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
103 emenu c Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
104 call assert_equal('cmdline', g:did_menu)
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
105
16541
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
106 nunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
107 call assert_fails('emenu n Test.FooBar', 'E335: Menu not defined for Normal mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
108 vunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
109 call assert_fails('emenu v Test.FooBar', 'E335: Menu not defined for Visual mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
110 vmenu 2 Test.FooBar :let g:did_menu = 'visual'<CR>
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
111 sunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
112 call assert_fails('emenu s Test.FooBar', 'E335: Menu not defined for Select mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
113 ounmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
114 call assert_fails('emenu o Test.FooBar', 'E335: Menu not defined for Op-pending mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
115 iunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
116 call assert_fails('emenu i Test.FooBar', 'E335: Menu not defined for Insert mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
117 cunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
118 call assert_fails('emenu c Test.FooBar', 'E335: Menu not defined for Cmdline mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
119 tlunmenu Test.FooBar
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
120 call assert_fails('emenu t Test.FooBar', 'E335: Menu not defined for Terminal mode')
822d00007b34 patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents: 14952
diff changeset
121
14952
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
122 aunmenu Test.FooBar
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
123 call assert_fails('emenu n Test.FooBar', 'E334:')
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
124
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
125 nmenu 2 Test.FooBar.Child :let g:did_menu = 'foobar'<CR>
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
126 call assert_fails('emenu n Test.FooBar', 'E333:')
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
127 nunmenu Test.FooBar.Child
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
128
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
129 unlet g:did_menu
405309f9dd13 patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 11183
diff changeset
130 endfun
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
131
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
132 " Test various menu related errors
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
133 func Test_menu_errors()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
134 menu Test.Foo :version<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
135
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
136 " Error cases
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
137 call assert_fails('menu .Test.Foo :ls<CR>', 'E475:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
138 call assert_fails('menu Test. :ls<CR>', 'E330:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
139 call assert_fails('menu Foo. :ls<CR>', 'E331:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
140 call assert_fails('unmenu Test.Foo abc', 'E488:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
141 call assert_fails('menu <Tab>:ls :ls<CR>', 'E792:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
142 call assert_fails('menu Test.<Tab>:ls :ls<CR>', 'E792:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
143 call assert_fails('menu Test.Foo.Bar :ls<CR>', 'E327:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
144 call assert_fails('menu Test.-Sep-.Baz :ls<CR>', 'E332:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
145 call assert_fails('menu Foo.Bar.--.Baz :ls<CR>', 'E332:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
146 call assert_fails('menu disable Test.Foo.Bar', 'E327:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
147 call assert_fails('menu disable T.Foo', 'E329:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
148 call assert_fails('unmenu Test.Foo.Bar', 'E327:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
149 call assert_fails('cunmenu Test.Foo', 'E328:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
150 call assert_fails('unmenu Test.Bar', 'E329:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
151 call assert_fails('menu Test.Foo.Bar', 'E327:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
152 call assert_fails('cmenu Test.Foo', 'E328:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
153 call assert_fails('emenu x Test.Foo', 'E475:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
154 call assert_fails('emenu Test.Foo.Bar', 'E327:')
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
155 call assert_fails('menutranslate Test', 'E474:')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
156
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
157 silent! unmenu Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
158 unmenu Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
159 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
160
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
161 " Test for menu item completion in command line
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
162 func Test_menu_expand()
19844
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
163 " Make sure we don't have stale menu items like Buffers menu.
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
164 source $VIMRUNTIME/delmenu.vim
d53e8428a79a patch 8.2.0478: new buffers are not added to the Buffers menu
Bram Moolenaar <Bram@vim.org>
parents: 19713
diff changeset
165
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
166 " Create the menu itmes for test
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
167 menu Dummy.Nothing lll
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
168 for i in range(1, 4)
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
169 let m = 'menu Xmenu.A' .. i .. '.A' .. i
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
170 for j in range(1, 4)
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
171 exe m .. 'B' .. j .. ' :echo "A' .. i .. 'B' .. j .. '"' .. "<CR>"
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
172 endfor
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
173 endfor
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
174 set wildmenu
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
175
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
176 " Test for <CR> selecting a submenu
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
177 call feedkeys(":emenu Xmenu.A\<Tab>\<CR>\<Right>x\<BS>\<C-B>\"\<CR>", 'xt')
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
178 call assert_equal('"emenu Xmenu.A1.A1B2', @:)
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
179
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
180 " Test for <Down> selecting a submenu
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
181 call feedkeys(":emenu Xmenu.A\<Tab>\<Right>\<Right>\<Down>" ..
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
182 \ "\<C-A>\<C-B>\"\<CR>", 'xt')
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
183 call assert_equal('"emenu Xmenu.A3.A3B1 A3B2 A3B3 A3B4', @:)
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
184
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
185 " Test for <Up> to go up a submenu
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
186 call feedkeys(":emenu Xmenu.A\<Tab>\<Down>\<Up>\<Right>\<Right>" ..
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
187 \ "\<Left>\<Down>\<C-A>\<C-B>\"\<CR>", 'xt')
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
188 call assert_equal('"emenu Xmenu.A2.A2B1 A2B2 A2B3 A2B4', @:)
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
189
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
190 " Test for <Up> to go up a menu
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
191 call feedkeys(":emenu Xmenu.A\<Tab>\<Down>\<Up>\<Up>\<Up>" ..
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
192 \ "\<C-A>\<C-B>\"\<CR>", 'xt')
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
193 call assert_equal('"emenu Dummy. Xmenu.', @:)
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
194
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
195 " Test for expanding only submenus
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
196 call feedkeys(":popup Xmenu.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
197 call assert_equal('"popup Xmenu.A1 A2 A3 A4', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
198
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
199 " Test for expanding menus after enable/disable
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
200 call feedkeys(":menu enable Xmenu.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
201 call assert_equal('"menu enable Xmenu.A1. A2. A3. A4.', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
202 call feedkeys(":menu disable Xmenu.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
203 call assert_equal('"menu disable Xmenu.A1. A2. A3. A4.', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
204
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
205 " Test for expanding non-existing menu path
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
206 call feedkeys(":menu xyz.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
207 call assert_equal('"menu xyz.', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
208 call feedkeys(":menu Xmenu.A1.A1B1.xyz.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
209 call assert_equal('"menu Xmenu.A1.A1B1.xyz.', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
210
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
211 set wildmenu&
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
212 unmenu Xmenu
19713
8514e8b7e661 patch 8.2.0413: buffer menu does not handle special buffers properly
Bram Moolenaar <Bram@vim.org>
parents: 19657
diff changeset
213 unmenu Dummy
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
214
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
215 " Test for expanding popup menus with some hidden items
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
216 menu Xmenu.foo.A1 a1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
217 menu Xmenu.]bar bar
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
218 menu Xmenu.]baz.B1 b1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
219 menu Xmenu.-sep- :
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
220 call feedkeys(":popup Xmenu.\<C-A>\<C-B>\"\<CR>", 'xt')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
221 call assert_equal('"popup Xmenu.foo', @:)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
222 unmenu Xmenu
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
223 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
224
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
225 " Test for the menu_info() function
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
226 func Test_menu_info()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
227 " Define menus with various attributes
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
228 10nnoremenu 10.10 T&est.F&oo :echo 'foo'<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
229 10nmenu <silent> 10.20 T&est.B&ar<Tab>:bar :echo 'bar'<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
230 10nmenu <script> 10.30.5 T&est.Ba&z.Qu&x :echo 'qux'<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
231
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
232 let d = #{name: "B&ar\t:bar", display: 'Bar', modes: 'n', shortcut: 'a',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
233 \ accel: ':bar', priority: 20, enabled: v:true, silent: v:true,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
234 \ noremenu: v:false, script: v:false, rhs: ":echo 'bar'<CR>"}
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
235 call assert_equal(d, menu_info('Test.Bar'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
236
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
237 let d = #{name: 'Ba&z', display: 'Baz', modes: 'n', shortcut: 'z',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
238 \ priority: 30, submenus: ['Qux']}
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
239 call assert_equal(d, menu_info('Test.Baz'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
240
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
241 let d = #{name: 'T&est', display: 'Test', modes: 'n', shortcut: 'e',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
242 \ priority: 10, submenus: ['Foo', 'Bar', 'Baz']}
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
243 call assert_equal(d, menu_info('Test'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
244 call assert_equal({}, menu_info('Test.Dummy'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
245 call assert_equal({}, menu_info('Dummy'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
246
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
247 nmenu disable Test.Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
248 call assert_equal(v:false, menu_info('Test.Foo').enabled)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
249 nmenu enable Test.Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
250 call assert_equal(v:true, menu_info('Test.Foo').enabled)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
251
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
252 call assert_equal(menu_info('Test.Foo'), menu_info('Test.Foo', ''))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
253 nmenu Test.abc <Nop>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
254 call assert_equal('<Nop>', menu_info('Test.abc').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
255 call assert_fails('call menu_info([])', 'E730:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19844
diff changeset
256 call assert_fails('call menu_info("", [])', 'E730:')
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
257 nunmenu Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
258
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
259 " Test for defining menus in different modes
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
260 menu Test.menu :menu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
261 menu! Test.menu! :menu!<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
262 amenu Test.amenu :amenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
263 nmenu Test.nmenu :nmenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
264 omenu Test.omenu :omenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
265 vmenu Test.vmenu :vmenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
266 xmenu Test.xmenu :xmenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
267 smenu Test.smenu :smenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
268 imenu <silent> <script> Test.imenu :imenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
269 cmenu Test.cmenu :cmenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
270 tlmenu Test.tlmenu :tlmenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
271 tmenu Test.nmenu Normal mode menu
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
272 tmenu Test.omenu Op-pending mode menu
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
273 noremenu Test.noremenu :noremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
274 noremenu! Test.noremenu! :noremenu!<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
275 anoremenu Test.anoremenu :anoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
276 nnoremenu Test.nnoremenu :nnoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
277 onoremenu Test.onoremenu :onoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
278 vnoremenu Test.vnoremenu :vnoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
279 xnoremenu Test.xnoremenu :xnoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
280 snoremenu Test.snoremenu :snoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
281 inoremenu <silent> Test.inoremenu :inoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
282 cnoremenu Test.cnoremenu :cnoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
283 tlnoremenu Test.tlnoremenu :tlnoremenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
284 call assert_equal(#{name: 'menu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
285 \ display: 'menu', modes: ' ', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
286 \ rhs: ":menu<CR>", noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
287 \ menu_info('Test.menu'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
288 call assert_equal(#{name: 'menu!', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
289 \ display: 'menu!', modes: '!', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
290 \ rhs: ":menu!<CR>", noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
291 \ menu_info('Test.menu!', '!'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
292 call assert_equal(#{name: 'amenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
293 \ display: 'amenu', modes: 'a', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
294 \ rhs: ":amenu<CR>", noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
295 \ menu_info('Test.amenu', 'a'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
296 call assert_equal(#{name: 'nmenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
297 \ display: 'nmenu', modes: 'n', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
298 \ rhs: ':nmenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
299 \ menu_info('Test.nmenu', 'n'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
300 call assert_equal(#{name: 'omenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
301 \ display: 'omenu', modes: 'o', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
302 \ rhs: ':omenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
303 \ menu_info('Test.omenu', 'o'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
304 call assert_equal(#{name: 'vmenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
305 \ display: 'vmenu', modes: 'v', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
306 \ rhs: ':vmenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
307 \ menu_info('Test.vmenu', 'v'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
308 call assert_equal(#{name: 'xmenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
309 \ display: 'xmenu', modes: 'x', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
310 \ rhs: ':xmenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
311 \ menu_info('Test.xmenu', 'x'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
312 call assert_equal(#{name: 'smenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
313 \ display: 'smenu', modes: 's', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
314 \ rhs: ':smenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
315 \ menu_info('Test.smenu', 's'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
316 call assert_equal(#{name: 'imenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
317 \ display: 'imenu', modes: 'i', enabled: v:true, silent: v:true,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
318 \ rhs: ':imenu<CR>', noremenu: v:false, script: v:true},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
319 \ menu_info('Test.imenu', 'i'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
320 call assert_equal(#{ name: 'cmenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
321 \ display: 'cmenu', modes: 'c', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
322 \ rhs: ':cmenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
323 \ menu_info('Test.cmenu', 'c'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
324 call assert_equal(#{name: 'tlmenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
325 \ display: 'tlmenu', modes: 'tl', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
326 \ rhs: ':tlmenu<CR>', noremenu: v:false, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
327 \ menu_info('Test.tlmenu', 'tl'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
328 call assert_equal(#{name: 'noremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
329 \ display: 'noremenu', modes: ' ', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
330 \ rhs: ":noremenu<CR>", noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
331 \ menu_info('Test.noremenu'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
332 call assert_equal(#{name: 'noremenu!', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
333 \ display: 'noremenu!', modes: '!', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
334 \ rhs: ":noremenu!<CR>", noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
335 \ menu_info('Test.noremenu!', '!'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
336 call assert_equal(#{name: 'anoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
337 \ display: 'anoremenu', modes: 'a', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
338 \ rhs: ":anoremenu<CR>", noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
339 \ menu_info('Test.anoremenu', 'a'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
340 call assert_equal(#{name: 'nnoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
341 \ display: 'nnoremenu', modes: 'n', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
342 \ rhs: ':nnoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
343 \ menu_info('Test.nnoremenu', 'n'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
344 call assert_equal(#{name: 'onoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
345 \ display: 'onoremenu', modes: 'o', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
346 \ rhs: ':onoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
347 \ menu_info('Test.onoremenu', 'o'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
348 call assert_equal(#{name: 'vnoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
349 \ display: 'vnoremenu', modes: 'v', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
350 \ rhs: ':vnoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
351 \ menu_info('Test.vnoremenu', 'v'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
352 call assert_equal(#{name: 'xnoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
353 \ display: 'xnoremenu', modes: 'x', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
354 \ rhs: ':xnoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
355 \ menu_info('Test.xnoremenu', 'x'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
356 call assert_equal(#{name: 'snoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
357 \ display: 'snoremenu', modes: 's', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
358 \ rhs: ':snoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
359 \ menu_info('Test.snoremenu', 's'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
360 call assert_equal(#{name: 'inoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
361 \ display: 'inoremenu', modes: 'i', enabled: v:true, silent: v:true,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
362 \ rhs: ':inoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
363 \ menu_info('Test.inoremenu', 'i'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
364 call assert_equal(#{ name: 'cnoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
365 \ display: 'cnoremenu', modes: 'c', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
366 \ rhs: ':cnoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
367 \ menu_info('Test.cnoremenu', 'c'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
368 call assert_equal(#{name: 'tlnoremenu', priority: 500, shortcut: '',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
369 \ display: 'tlnoremenu', modes: 'tl', enabled: v:true, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
370 \ rhs: ':tlnoremenu<CR>', noremenu: v:true, script: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
371 \ menu_info('Test.tlnoremenu', 'tl'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
372 aunmenu Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
373 tlunmenu Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
374 call assert_equal({}, menu_info('Test'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
375 call assert_equal({}, menu_info('Test', '!'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
376 call assert_equal({}, menu_info('Test', 'a'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
377 call assert_equal({}, menu_info('Test', 'n'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
378 call assert_equal({}, menu_info('Test', 'o'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
379 call assert_equal({}, menu_info('Test', 'v'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
380 call assert_equal({}, menu_info('Test', 'x'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
381 call assert_equal({}, menu_info('Test', 's'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
382 call assert_equal({}, menu_info('Test', 'i'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
383 call assert_equal({}, menu_info('Test', 'c'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
384 call assert_equal({}, menu_info('Test', 't'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
385 call assert_equal({}, menu_info('Test', 'tl'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
386
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
387 amenu Test.amenu :amenu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
388 call assert_equal(':amenu<CR>', menu_info('Test.amenu', '').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
389 call assert_equal('<C-\><C-O>:amenu<CR>', menu_info('Test.amenu', '!').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
390 call assert_equal(':amenu<CR>', menu_info('Test.amenu', 'n').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
391 call assert_equal('<C-C>:amenu<CR><C-\><C-G>',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
392 \ menu_info('Test.amenu', 'o').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
393 call assert_equal('<C-C>:amenu<CR><C-\><C-G>',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
394 \ menu_info('Test.amenu', 'v').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
395 call assert_equal('<C-C>:amenu<CR><C-\><C-G>',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
396 \ menu_info('Test.amenu', 'x').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
397 call assert_equal('<C-C>:amenu<CR><C-\><C-G>',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
398 \ menu_info('Test.amenu', 's').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
399 call assert_equal('<C-\><C-O>:amenu<CR>', menu_info('Test.amenu', 'i').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
400 call assert_equal('<C-C>:amenu<CR><C-\><C-G>',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
401 \ menu_info('Test.amenu', 'c').rhs)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
402 aunmenu Test.amenu
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
403
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
404 " Test for hidden menus
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
405 menu ]Test.menu :menu<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
406 call assert_equal(#{name: ']Test', display: ']Test', priority: 500,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
407 \ shortcut: '', modes: ' ', submenus: ['menu']},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
408 \ menu_info(']Test'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
409 unmenu ]Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
410 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
411
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
412 " Test for <special> keyword in a menu with 'cpo' containing '<'
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
413 func Test_menu_special()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
414 new
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
415 set cpo+=<
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
416 nmenu Test.Sign am<Tab>n<Esc>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
417 call feedkeys(":emenu n Test.Sign\<CR>", 'x')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
418 call assert_equal("m<Tab>n<Esc>", getline(1))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
419 nunmenu Test.Sign
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
420 nmenu <special> Test.Sign am<Tab>n<Esc>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
421 call setline(1, '')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
422 call feedkeys(":emenu n Test.Sign\<CR>", 'x')
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
423 call assert_equal("m\tn", getline(1))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
424 set cpo-=<
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
425 close!
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
426 nunmenu Test.Sign
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
427 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
428
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
429 " Test for "icon=filename" in a toolbar
19657
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
430 func Test_menu_icon()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
431 CheckFeature toolbar
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
432 nmenu icon=myicon.xpm Toolbar.Foo :echo "Foo"<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
433 call assert_equal('myicon.xpm', "Toolbar.Foo"->menu_info().icon)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
434 nunmenu Toolbar.Foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
435
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
436 " Test for using the builtin icon
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
437 amenu ToolBar.BuiltIn22 :echo "BuiltIn22"<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
438 call assert_equal(#{name: 'BuiltIn22', display: 'BuiltIn22',
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
439 \ enabled: v:true, shortcut: '', modes: 'a', script: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
440 \ iconidx: 22, priority: 500, silent: v:false,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
441 \ rhs: ':echo "BuiltIn22"<CR>', noremenu: v:false},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
442 \ menu_info("ToolBar.BuiltIn22"))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
443 aunmenu ToolBar.BuiltIn22
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
444 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
445
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
446 " Test for ":emenu" command in different modes
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
447 func Test_emenu_cmd()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
448 new
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
449 xmenu Test.foo rx
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
450 call setline(1, ['aaaa', 'bbbb'])
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
451 normal ggVj
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
452 %emenu Test.foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
453 call assert_equal(['xxxx', 'xxxx'], getline(1, 2))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
454 call setline(1, ['aaaa', 'bbbb'])
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
455 exe "normal ggVj\<Esc>"
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
456 %emenu Test.foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
457 call assert_equal(['xxxx', 'xxxx'], getline(1, 2))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
458 call setline(1, ['aaaa', 'bbbb'])
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
459 exe "normal ggV\<Esc>"
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
460 2emenu Test.foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
461 call assert_equal(['aaaa', 'xxxx'], getline(1, 2))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
462 xunmenu Test.foo
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
463 close!
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
464 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
465
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
466 " Test for PopUp menus
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
467 func Test_popup_menu()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
468 20menu PopUp.foo :echo 'foo'<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
469 20menu PopUp.bar :echo 'bar'<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
470 call assert_equal(#{name: 'PopUp', display: 'PopUp', priority: 20,
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
471 \ shortcut: '', modes: ' ', submenus: ['foo', 'bar']},
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
472 \ menu_info('PopUp'))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
473 menu disable PopUp.bar
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
474 call assert_equal(v:true, "PopUp.foo"->menu_info().enabled)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
475 call assert_equal(v:false, "PopUp.bar"->menu_info().enabled)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
476 menu enable PopUp.bar
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
477 call assert_equal(v:true, "PopUp.bar"->menu_info().enabled)
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
478 unmenu PopUp
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
479 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
480
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
481 " Test for listing the menus using the :menu command
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
482 func Test_show_menus()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
483 " In the GUI, tear-off menu items are present in the output below
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
484 " So skip this test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
485 CheckNotGui
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
486 aunmenu *
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
487 call assert_equal(['--- Menus ---'], split(execute('menu'), "\n"))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
488 nmenu <script> 200.10 Test.nmenu1 :nmenu1<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
489 nmenu 200.20 Test.nmenu2 :nmenu2<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
490 nnoremenu 200.30 Test.nmenu3 :nmenu3<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
491 nmenu 200.40 Test.nmenu4 :nmenu4<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
492 nmenu 200.50 disable Test.nmenu4
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
493 let exp =<< trim [TEXT]
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
494 --- Menus ---
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
495 200 Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
496 10 nmenu1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
497 n& :nmenu1<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
498 20 nmenu2
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
499 n :nmenu2<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
500 30 nmenu3
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
501 n* :nmenu3<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
502 40 nmenu4
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
503 n - :nmenu4<CR>
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
504 [TEXT]
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
505 call assert_equal(exp, split(execute('nmenu'), "\n"))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
506 nunmenu Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
507 endfunc
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
508
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
509 " Test for menu tips
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
510 func Test_tmenu()
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
511 tunmenu *
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
512 call assert_equal(['--- Menus ---'], split(execute('tmenu'), "\n"))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
513 tmenu Test.nmenu1 nmenu1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
514 tmenu Test.nmenu2.sub1 nmenu2.sub1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
515 let exp =<< trim [TEXT]
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
516 --- Menus ---
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
517 500 Test
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
518 500 nmenu1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
519 t - nmenu1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
520 500 nmenu2
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
521 500 sub1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
522 t - nmenu2.sub1
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
523 [TEXT]
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
524 call assert_equal(exp, split(execute('tmenu'), "\n"))
da791e5c0139 patch 8.2.0385: menu functionality insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19517
diff changeset
525 tunmenu Test
19517
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
526 endfunc
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
527
738a4fe2c8c5 patch 8.2.0316: ex_getln.c code has insufficient test coverage
Bram Moolenaar <Bram@vim.org>
parents: 18977
diff changeset
528 " vim: shiftwidth=2 sts=2 expandtab