From 9fb8b47ad845b0dc95da64705276c9f163e97f6c Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sat, 30 Sep 2017 22:21:06 +0200 Subject: menu_get: adjust tests for prettyprinting ... and add a bit of new testing --- test/functional/ex_cmds/menu_spec.lua | 102 +++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/ex_cmds/menu_spec.lua b/test/functional/ex_cmds/menu_spec.lua index 55da8da8dc..5238752af4 100644 --- a/test/functional/ex_cmds/menu_spec.lua +++ b/test/functional/ex_cmds/menu_spec.lua @@ -107,7 +107,7 @@ describe('menu_get', function() sid = 1, noremap = 1, enabled = 1, - rhs = "inormal\27", + rhs = "inormal", silent = 0 }, v = { @@ -242,7 +242,7 @@ describe('menu_get', function() sid = 1, noremap = 1, enabled = 1, - rhs = "\18\"", + rhs = "\"", silent = 0 }, n = { @@ -380,4 +380,102 @@ describe('menu_get', function() eq(expected, m) end) + it('prettyprints special chars', function() + clear() + command('nnoremenu &Test.Test inormal') + command('inoremenu &Test.Test2 ') + command('vnoremenu &Test.Test3 yA0xyz') + command('inoremenu &Test.Test4 *') + command('inoremenu &Test.Test5 +') + local m = funcs.menu_get("","a"); + local expected = { + { + shortcut = "T", + hidden = 0, + submenus = { + { + priority = 500, + mappings = { + n = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "inormal", + silent = 0 + } + }, + name = "Test", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "", + silent = 0 + } + }, + name = "Test2", + hidden = 0 + }, + { + priority = 500, + mappings = { + s = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "yA0xyz", + silent = 0 + }, + v = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "yA0xyz", + silent = 0 + } + }, + name = "Test3", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "*", + silent = 0 + } + }, + name = "Test4", + hidden = 0 + }, + { + priority = 500, + mappings = { + i = { + sid = 1, + noremap = 1, + enabled = 1, + rhs = "+", + silent = 0 + } + }, + name = "Test5", + hidden = 0 + } + }, + priority = 500, + name = "Test" + } + } + + eq(m, expected) + end) end) -- cgit