diff options
Diffstat (limited to 'test/functional/ex_cmds/menu_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/menu_spec.lua | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua index 2c0535acda..2309e949c0 100644 --- a/test/functional/ex_cmds/menu_spec.lua +++ b/test/functional/ex_cmds/menu_spec.lua @@ -63,25 +63,27 @@ describe('menu_get', function() before_each(function() clear() - command('nnoremenu &Test.Test inormal<ESC>') - command('inoremenu Test.Test insert') - command('vnoremenu Test.Test x') - command('cnoremenu Test.Test cmdmode') - command('menu Test.Nested.test level1') - command('menu Test.Nested.Nested2 level2') + command([=[ + nnoremenu &Test.Test inormal<ESC> + inoremenu Test.Test insert + vnoremenu Test.Test x + cnoremenu Test.Test cmdmode + menu Test.Nested.test level1 + menu Test.Nested.Nested2 level2 - command('nnoremenu <script> Export.Script p') - command('tmenu Export.Script This is the tooltip') - command('menu ]Export.hidden thisoneshouldbehidden') + nnoremenu <script> Export.Script p + tmenu Export.Script This is the tooltip + menu ]Export.hidden thisoneshouldbehidden - command('nnoremenu Edit.Paste p') - command('cnoremenu Edit.Paste <C-R>"') + nnoremenu Edit.Paste p + cnoremenu Edit.Paste <C-R>" + ]=]) end) it("path='', modes='a'", function() local m = funcs.menu_get("","a"); -- HINT: To print the expected table and regenerate the tests: - -- print(require('pl.pretty').dump(m)) + -- print(require('inspect')(m)) local expected = { { shortcut = "T", @@ -306,10 +308,13 @@ describe('menu_get', function() eq(expected, m) end) - it('matching path, default modes', function() + it('matching path, all modes', function() local m = funcs.menu_get("Export", "a") - local expected = { - { + local expected = { { + hidden = 0, + name = "Export", + priority = 500, + submenus = { { tooltip = "This is the tooltip", hidden = 0, name = "Script", @@ -323,8 +328,8 @@ describe('menu_get', function() silent = 0 } } - } - } + } } + } } eq(expected, m) end) @@ -349,8 +354,6 @@ describe('menu_get', function() name = "Test", hidden = 0 }, - { - } }, priority = 500, name = "Test" @@ -363,14 +366,22 @@ describe('menu_get', function() local m = funcs.menu_get("Test","i") local expected = { { - mappings = { - i = { - sid = 1, - noremap = 1, - enabled = 1, - rhs = "insert", - silent = 0 - } + shortcut = "T", + submenus = { + { + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "insert", + silent = 0 + }, + }, + priority = 500, + name = "Test", + hidden = 0 + }, }, priority = 500, name = "Test", |