aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-27 01:32:12 +0100
committerGitHub <noreply@github.com>2019-01-27 01:32:12 +0100
commit9697c7f56a269969ef2b784f66483b382278f1d7 (patch)
tree7909cdf506ffab93463a23f6d45a74990d464f70 /test
parentd63b534f313326c79c7b9feaf51ca0d798dd65db (diff)
parent1a3d2dbfe7aadef46b26eac125949a3e1b100194 (diff)
downloadrneovim-9697c7f56a269969ef2b784f66483b382278f1d7.tar.gz
rneovim-9697c7f56a269969ef2b784f66483b382278f1d7.tar.bz2
rneovim-9697c7f56a269969ef2b784f66483b382278f1d7.zip
Merge #8194 from justinmk/fix-menu
fix ":menu Item.SubItem", fix menu_get("foo")
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/menu_spec.lua65
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",