diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/legacy/cmdline_spec.lua | 29 | ||||
-rw-r--r-- | test/functional/legacy/ex_mode_spec.lua | 51 | ||||
-rw-r--r-- | test/functional/legacy/global_spec.lua | 51 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 10 |
4 files changed, 139 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) diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 50247ed214..5967b630f6 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -18,6 +18,7 @@ local run = helpers.run local pcall_err = helpers.pcall_err local tbl_contains = global_helpers.tbl_contains local curbuf, curwin, curtab = helpers.curbuf, helpers.curwin, helpers.curtab +local NIL = helpers.NIL describe('float window', function() before_each(function() @@ -420,6 +421,15 @@ describe('float window', function() eq(winids, eval('winids')) end) + it("no segfault when setting minimal style after clearing local 'fillchars' #19510", function() + local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} + local float_win = meths.open_win(0, true, float_opts) + meths.win_set_option(float_win, 'fillchars', NIL) + float_opts.style = 'minimal' + meths.win_set_config(float_win, float_opts) + assert_alive() + end) + describe('with only one tabpage,', function() local float_opts = {relative = 'editor', row = 1, col = 1, width = 1, height = 1} local old_buf, old_win |