aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/cmdline_spec.lua
diff options
context:
space:
mode:
authorDongdong Zhou <dzhou121@gmail.com>2017-05-11 07:51:10 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2017-10-26 09:35:13 +0200
commit866dadaf753ba3733feb8c22d7da47af757bd35c (patch)
treec96ea0abcdf2fe4856a0f99ccac89d1fc022065e /test/functional/ui/cmdline_spec.lua
parentab85999eb7c53e9d2b5bca5f8896ea11cb1df13e (diff)
downloadrneovim-866dadaf753ba3733feb8c22d7da47af757bd35c.tar.gz
rneovim-866dadaf753ba3733feb8c22d7da47af757bd35c.tar.bz2
rneovim-866dadaf753ba3733feb8c22d7da47af757bd35c.zip
ext_cmdline: added cmdline level
add cchar_to_string
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
-rw-r--r--test/functional/ui/cmdline_spec.lua52
1 files changed, 44 insertions, 8 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 479f5c3b7d..479d40e959 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -7,19 +7,19 @@ if helpers.pending_win32(pending) then return end
describe('External command line completion', function()
local screen
local shown = false
- local firstc, prompt, content, pos, char, shift
+ local firstc, prompt, content, pos, char, shift, level, current_hide_level
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:attach({rgb=true, ext_cmdline=true})
screen:set_on_event_handler(function(name, data)
- if name == "cmdline_enter" then
- shown = true
- elseif name == "cmdline_hide" then
+ if name == "cmdline_hide" then
shown = false
+ current_hide_level = data[1]
elseif name == "cmdline_show" then
- content, pos, firstc, prompt = unpack(data)
+ shown = true
+ content, pos, firstc, prompt, level = unpack(data)
elseif name == "cmdline_char" then
char, shift = unpack(data)
elseif name == "cmdline_pos" then
@@ -107,9 +107,9 @@ describe('External command line completion', function()
eq("input", prompt)
eq({{'Normal', 'default'}}, content)
end)
-
feed('<cr>')
- feed(':<C-R>=1+2<cr>')
+
+ feed(':')
screen:expect([[
^ |
~ |
@@ -117,9 +117,45 @@ describe('External command line completion', function()
~ |
|
]], nil, nil, function()
- eq({{'Normal', '3'}}, content)
+ eq(1, level)
+ end)
+
+ feed('<C-R>=1+2')
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]], nil, nil, function()
+ eq({{'Normal', '1+2'}}, content)
eq("\"", char)
eq(1, shift)
+ eq(2, level)
+ end)
+
+ feed('<cr>')
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]], nil, nil, function()
+ eq({{'Normal', '3'}}, content)
+ eq(2, current_hide_level)
+ eq(1, level)
+ end)
+
+ feed('<esc>')
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]], nil, nil, function()
+ eq(1, current_hide_level)
end)
end)