aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-27 07:25:13 +0800
committerGitHub <noreply@github.com>2022-07-27 07:25:13 +0800
commit2fdb0de1975b015d8745141eaa18e62af793e0ef (patch)
treeda96e28622a4caf0a304f1827439b01a88829778 /test
parent49d2256ae5b747830160a1dd1f3f532cf726b394 (diff)
parentfc55f8263c6c8d8851fa2b6290083a64da1ebd28 (diff)
downloadrneovim-2fdb0de1975b015d8745141eaa18e62af793e0ef.tar.gz
rneovim-2fdb0de1975b015d8745141eaa18e62af793e0ef.tar.bz2
rneovim-2fdb0de1975b015d8745141eaa18e62af793e0ef.zip
Merge pull request #19528 from zeertzjq/vim-9.0.0051
vim-patch:9.0.{0051,0082,0083,0086}: cmdline fixes
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/cmdline_spec.lua29
-rw-r--r--test/functional/legacy/ex_mode_spec.lua51
-rw-r--r--test/functional/legacy/global_spec.lua51
3 files changed, 129 insertions, 2 deletions
diff --git a/test/functional/legacy/cmdline_spec.lua b/test/functional/legacy/cmdline_spec.lua
index d8d849271b..cf02636890 100644
--- a/test/functional/legacy/cmdline_spec.lua
+++ b/test/functional/legacy/cmdline_spec.lua
@@ -3,11 +3,12 @@ local Screen = require('test.functional.ui.screen')
local clear = helpers.clear
local feed = helpers.feed
local feed_command = helpers.feed_command
-local source = helpers.source
+local exec = helpers.exec
describe('cmdline', function()
before_each(clear)
+ -- oldtest: Test_cmdlineclear_tabenter()
it('is cleared when switching tabs', function()
local screen = Screen.new(30, 10)
screen:attach()
@@ -91,10 +92,11 @@ describe('cmdline', function()
]])
end)
+ -- oldtest: Test_verbose_option()
it('prints every executed Ex command if verbose >= 16', function()
local screen = Screen.new(60, 12)
screen:attach()
- source([[
+ exec([[
command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v
call feedkeys("\r", 't') " for the hit-enter prompt
set verbose=20
@@ -115,4 +117,27 @@ describe('cmdline', function()
Press ENTER or type command to continue^ |
]])
end)
+
+ -- oldtest: Test_cmdline_redraw_tabline()
+ it('tabline is redrawn on entering cmdline', function()
+ local screen = Screen.new(30, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ [1] = {reverse = true}, -- TabLineFill
+ })
+ screen:attach()
+ exec([[
+ set showtabline=2
+ autocmd CmdlineEnter * set tabline=foo
+ ]])
+ feed(':')
+ screen:expect([[
+ {1:foo }|
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :^ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/ex_mode_spec.lua b/test/functional/legacy/ex_mode_spec.lua
index 98f113bbd0..a8f54c6939 100644
--- a/test/functional/legacy/ex_mode_spec.lua
+++ b/test/functional/legacy/ex_mode_spec.lua
@@ -6,6 +6,7 @@ local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
local meths = helpers.meths
+local sleep = helpers.sleep
before_each(clear)
@@ -122,4 +123,54 @@ describe('Ex mode', function()
|
]])
end)
+
+ it('pressing Ctrl-C in :append inside a loop in Ex mode does not hang', function()
+ local screen = Screen.new(60, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, reverse = true}, -- MsgSeparator
+ [1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
+ })
+ screen:attach()
+ feed('gQ')
+ feed('for i in range(1)<CR>')
+ feed('append<CR>')
+ screen:expect([[
+ {0: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :for i in range(1) |
+ |
+ : append |
+ ^ |
+ ]])
+ feed('<C-C>')
+ sleep(10) -- Wait for input to be flushed
+ feed('foo<CR>')
+ screen:expect([[
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :for i in range(1) |
+ |
+ : append |
+ foo |
+ ^ |
+ ]])
+ feed('.<CR>')
+ screen:expect([[
+ :for i in range(1) |
+ |
+ : append |
+ foo |
+ . |
+ : ^ |
+ ]])
+ feed('endfor<CR>')
+ feed('vi<CR>')
+ screen:expect([[
+ ^foo |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/legacy/global_spec.lua b/test/functional/legacy/global_spec.lua
new file mode 100644
index 0000000000..9f4528530c
--- /dev/null
+++ b/test/functional/legacy/global_spec.lua
@@ -0,0 +1,51 @@
+local helpers = require('test.functional.helpers')(after_each)
+local Screen = require('test.functional.ui.screen')
+local clear = helpers.clear
+local exec = helpers.exec
+local feed = helpers.feed
+local sleep = helpers.sleep
+
+before_each(clear)
+
+describe(':global', function()
+ -- oldtest: Test_interrupt_global()
+ it('can be interrupted using Ctrl-C in cmdline mode vim-patch:9.0.0082', function()
+ local screen = Screen.new(75, 6)
+ screen:set_default_attr_ids({
+ [0] = {bold = true, reverse = true}, -- MsgSeparator
+ [1] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg
+ })
+ screen:attach()
+
+ exec([[
+ set nohlsearch noincsearch
+ cnoremap ; <Cmd>sleep 10<CR>
+ call setline(1, repeat(['foo'], 5))
+ ]])
+
+ feed(':g/foo/norm :<C-V>;<CR>')
+ sleep(10) -- Wait for :sleep to start
+ feed('<C-C>')
+ screen:expect([[
+ ^foo |
+ foo |
+ foo |
+ foo |
+ foo |
+ {1:Interrupted} |
+ ]])
+
+ -- Also test in Ex mode
+ feed('gQg/foo/norm :<C-V>;<CR>')
+ sleep(10) -- Wait for :sleep to start
+ feed('<C-C>')
+ screen:expect([[
+ {0: }|
+ Entering Ex mode. Type "visual" to go to Normal mode. |
+ :g/foo/norm :; |
+ |
+ {1:Interrupted} |
+ :^ |
+ ]])
+ end)
+end)