diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 12 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 32 | ||||
-rw-r--r-- | test/functional/ui/fold_spec.lua | 24 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 20 |
4 files changed, 88 insertions, 0 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index a9d4c72d31..daf20c006c 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -7,6 +7,7 @@ local meths = helpers.meths local funcs = helpers.funcs local pcall_err = helpers.pcall_err local ok = helpers.ok +local assert_alive = helpers.assert_alive describe('API: highlight',function() local expected_rgb = { @@ -145,4 +146,15 @@ describe('API: highlight',function() eq({foreground=tonumber("0x888888"), background=tonumber("0x888888")}, meths.get_hl_by_name("Shrubbery", true)) end) + + it("nvim_buf_add_highlight to other buffer doesn't crash if undo is disabled #12873", function() + command('vsplit file') + local err, _ = pcall(meths.buf_set_option, 1, 'undofile', false) + eq(true, err) + err, _ = pcall(meths.buf_set_option, 1, 'undolevels', -1) + eq(true, err) + err, _ = pcall(meths.buf_add_highlight, 1, -1, 'Question', 0, 0, -1) + eq(true, err) + assert_alive() + end) end) diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 21c01b3458..01f0d8a4d7 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local source = helpers.source local command = helpers.command +local feed_command = helpers.feed_command local function new_screen(opt) local screen = Screen.new(25, 5) @@ -842,3 +843,34 @@ describe('cmdline redraw', function() ]], unchanged=true} end) end) + +describe('cmdline', function() + before_each(function() + clear() + end) + + it('prints every executed Ex command if verbose >= 16', function() + local screen = Screen.new(50, 12) + screen:attach() + source([[ + command DoSomething echo 'hello' |set ts=4 |let v = '123' |echo v + call feedkeys("\r", 't') " for the hit-enter prompt + set verbose=20 + ]]) + feed_command('DoSomething') + screen:expect([[ + | + ~ | + | + Executing: DoSomething | + Executing: echo 'hello' |set ts=4 |let v = '123' || + echo v | + hello | + Executing: set ts=4 |let v = '123' |echo v | + Executing: let v = '123' |echo v | + Executing: echo v | + 123 | + Press ENTER or type command to continue^ | + ]]) + end) +end) diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index fe67b9f6b0..9877f30206 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -6,6 +6,8 @@ local feed_command = helpers.feed_command local insert = helpers.insert local funcs = helpers.funcs local meths = helpers.meths +local source = helpers.source +local assert_alive = helpers.assert_alive describe("folded lines", function() local screen @@ -357,4 +359,26 @@ describe("folded lines", function() | ]]} end) + + it('does not crash when foldtext is longer than columns #12988', function() + source([[ + function! MyFoldText() abort + return repeat('-', &columns + 100) + endfunction + ]]) + command('set foldtext=MyFoldText()') + feed("i<cr><esc>") + feed("vkzf") + screen:expect{grid=[[ + {5:^---------------------------------------------}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + assert_alive() + end) end) diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 74e85212c8..16c5477ee4 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -2750,6 +2750,26 @@ it(':substitute with inccommand, timer-induced :redraw #9777', function() ]]) end) +it(":substitute doesn't crash with inccommand, if undo is empty #12932", function() + local screen = Screen.new(10,5) + clear() + command('set undolevels=-1') + common_setup(screen, 'split', 'test') + feed(':%s/test') + sleep(100) + feed('/') + sleep(100) + feed('f') + screen:expect([[ + {12:f} | + {15:~ }| + {15:~ }| + {15:~ }| + :%s/test/f^ | + ]]) + assert_alive() +end) + it('long :%s/ with inccommand does not collapse cmdline', function() local screen = Screen.new(10,5) clear() |