aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/vimscript
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/vimscript')
-rw-r--r--test/functional/vimscript/api_functions_spec.lua18
-rw-r--r--test/functional/vimscript/eval_spec.lua92
-rw-r--r--test/functional/vimscript/execute_spec.lua4
-rw-r--r--test/functional/vimscript/has_spec.lua9
-rw-r--r--test/functional/vimscript/input_spec.lua1
-rw-r--r--test/functional/vimscript/match_functions_spec.lua1
-rw-r--r--test/functional/vimscript/system_spec.lua8
-rw-r--r--test/functional/vimscript/timer_spec.lua9
8 files changed, 18 insertions, 124 deletions
diff --git a/test/functional/vimscript/api_functions_spec.lua b/test/functional/vimscript/api_functions_spec.lua
index 30d6c969ca..5db8c24120 100644
--- a/test/functional/vimscript/api_functions_spec.lua
+++ b/test/functional/vimscript/api_functions_spec.lua
@@ -129,8 +129,6 @@ describe('eval-API', function()
end)
it('use buffer numbers and windows ids as handles', function()
- local screen = Screen.new(40, 8)
- screen:attach()
local bnr = eval("bufnr('')")
local bhnd = eval('nvim_get_current_buf()')
local wid = eval('win_getid()')
@@ -192,14 +190,6 @@ describe('eval-API', function()
it('are highlighted by vim.vim syntax file', function()
local screen = Screen.new(40, 8)
- screen:attach()
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Brown },
- [2] = { foreground = Screen.colors.DarkCyan },
- [3] = { foreground = Screen.colors.SlateBlue },
- [4] = { foreground = Screen.colors.Fuchsia },
- [5] = { bold = true, foreground = Screen.colors.Blue },
- })
command('set ft=vim')
command('set rtp^=build/runtime/')
@@ -210,10 +200,10 @@ describe('eval-API', function()
call not_a_function(42)]])
screen:expect([[
- {1:call} {2:bufnr}{3:(}{4:'%'}{3:)} |
- {1:call} {2:nvim_input}{3:(}{4:'typing...'}{3:)} |
- {1:call} not_a_function{3:(}{4:42}{3:^)} |
- {5:~ }|*4
+ {15:call} {25:bufnr}{16:(}{26:'%'}{16:)} |
+ {15:call} {25:nvim_input}{16:(}{26:'typing...'}{16:)} |
+ {15:call} not_a_function{16:(}{26:42}{16:^)} |
+ {1:~ }|*4
|
]])
end)
diff --git a/test/functional/vimscript/eval_spec.lua b/test/functional/vimscript/eval_spec.lua
index 0c812d968e..2a4835f7e1 100644
--- a/test/functional/vimscript/eval_spec.lua
+++ b/test/functional/vimscript/eval_spec.lua
@@ -25,8 +25,6 @@ local command = n.command
local write_file = t.write_file
local api = n.api
local sleep = vim.uv.sleep
-local matches = t.matches
-local pcall_err = t.pcall_err
local assert_alive = n.assert_alive
local poke_eventloop = n.poke_eventloop
local feed = n.feed
@@ -189,12 +187,6 @@ describe('uncaught exception', function()
it('multiline exception remains multiline #25350', function()
local screen = Screen.new(80, 11)
- screen:set_default_attr_ids({
- [1] = { bold = true, reverse = true }, -- MsgSeparator
- [2] = { foreground = Screen.colors.White, background = Screen.colors.Red }, -- ErrorMsg
- [3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg
- })
- screen:attach()
exec_lua([[
function _G.Oops()
error("oops")
@@ -203,17 +195,17 @@ describe('uncaught exception', function()
feed(':try\rlua _G.Oops()\rendtry\r')
screen:expect {
grid = [[
- {1: }|
+ {3: }|
:try |
: lua _G.Oops() |
: endtry |
- {2:Error detected while processing :} |
- {2:E5108: Error executing lua [string "<nvim>"]:2: oops} |
- {2:stack traceback:} |
- {2: [C]: in function 'error'} |
- {2: [string "<nvim>"]:2: in function 'Oops'} |
- {2: [string ":lua"]:1: in main chunk} |
- {3:Press ENTER or type command to continue}^ |
+ {9:Error detected while processing :} |
+ {9:E5108: Error executing lua [string "<nvim>"]:2: oops} |
+ {9:stack traceback:} |
+ {9: [C]: in function 'error'} |
+ {9: [string "<nvim>"]:2: in function 'Oops'} |
+ {9: [string ":lua"]:1: in main chunk} |
+ {6:Press ENTER or type command to continue}^ |
]],
}
end)
@@ -233,74 +225,6 @@ describe('listing functions using :function', function()
exec_capture(('function <lambda>%s'):format(num))
)
end)
-
- it('does not crash if another function is deleted while listing', function()
- local screen = Screen.new(80, 24)
- screen:attach()
- matches(
- 'Vim%(function%):E454: Function list was modified$',
- pcall_err(
- exec_lua,
- [=[
- vim.cmd([[
- func Func1()
- endfunc
- func Func2()
- endfunc
- func Func3()
- endfunc
- ]])
-
- local ns = vim.api.nvim_create_namespace('test')
-
- vim.ui_attach(ns, { ext_messages = true }, function(event, _, content)
- if event == 'msg_show' and content[1][2] == 'function Func1()' then
- vim.cmd('delfunc Func3')
- end
- end)
-
- vim.cmd('function')
-
- vim.ui_detach(ns)
- ]=]
- )
- )
- assert_alive()
- end)
-
- it('does not crash if the same function is deleted while listing', function()
- local screen = Screen.new(80, 24)
- screen:attach()
- matches(
- 'Vim%(function%):E454: Function list was modified$',
- pcall_err(
- exec_lua,
- [=[
- vim.cmd([[
- func Func1()
- endfunc
- func Func2()
- endfunc
- func Func3()
- endfunc
- ]])
-
- local ns = vim.api.nvim_create_namespace('test')
-
- vim.ui_attach(ns, { ext_messages = true }, function(event, _, content)
- if event == 'msg_show' and content[1][2] == 'function Func1()' then
- vim.cmd('delfunc Func2')
- end
- end)
-
- vim.cmd('function')
-
- vim.ui_detach(ns)
- ]=]
- )
- )
- assert_alive()
- end)
end)
it('no double-free in garbage collection #16287', function()
diff --git a/test/functional/vimscript/execute_spec.lua b/test/functional/vimscript/execute_spec.lua
index 8caaea39a7..2404538e77 100644
--- a/test/functional/vimscript/execute_spec.lua
+++ b/test/functional/vimscript/execute_spec.lua
@@ -114,7 +114,6 @@ describe('execute()', function()
it('does not corrupt the command display #5422', function()
local screen = Screen.new(70, 7)
- screen:attach()
feed(':echo execute("hi ErrorMsg")<CR>')
screen:expect(
[[
@@ -136,7 +135,6 @@ describe('execute()', function()
it('places cursor correctly #6035', function()
local screen = Screen.new(40, 6)
- screen:attach()
source([=[
" test 1: non-silenced output goes as usual
function! Test1()
@@ -263,7 +261,6 @@ describe('execute()', function()
describe('{silent} argument', function()
it('captures & displays output for ""', function()
local screen = Screen.new(40, 5)
- screen:attach()
command('let g:mes = execute("echon 42", "")')
screen:expect([[
^ |
@@ -287,7 +284,6 @@ describe('execute()', function()
it('captures but does not display output for "silent"', function()
local screen = Screen.new(40, 5)
- screen:attach()
command('let g:mes = execute("echon 42")')
screen:expect([[
^ |
diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua
index 1d2187be6b..ff90edfe30 100644
--- a/test/functional/vimscript/has_spec.lua
+++ b/test/functional/vimscript/has_spec.lua
@@ -4,6 +4,7 @@ local Screen = require('test.functional.ui.screen')
local clear = n.clear
local connect = n.connect
+local get_session = n.get_session
local eq = t.eq
local fn = n.fn
local is_os = t.is_os
@@ -74,12 +75,12 @@ describe('has()', function()
it('"gui_running"', function()
eq(0, fn.has('gui_running'))
- local tui = Screen.new(50, 15)
+ local tui_session = get_session()
local gui_session = connect(fn.serverstart())
- local gui = Screen.new(50, 15)
eq(0, fn.has('gui_running'))
- tui:attach({ ext_linegrid = true, rgb = true, stdin_tty = true, stdout_tty = true })
- gui:attach({ ext_multigrid = true, rgb = true }, gui_session)
+ local tui = Screen.new(50, 5, { rgb = true, stdin_tty = true, stdout_tty = true }, tui_session)
+ eq(0, fn.has('gui_running'))
+ local gui = Screen.new(50, 15, { ext_multigrid = true, rgb = true }, gui_session)
eq(1, fn.has('gui_running'))
tui:detach()
eq(1, fn.has('gui_running'))
diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua
index 0b774404eb..1995b033b9 100644
--- a/test/functional/vimscript/input_spec.lua
+++ b/test/functional/vimscript/input_spec.lua
@@ -17,7 +17,6 @@ local screen
before_each(function()
clear()
screen = Screen.new(25, 5)
- screen:attach()
source([[
hi Test ctermfg=Red guifg=Red term=bold
function CustomCompl(...)
diff --git a/test/functional/vimscript/match_functions_spec.lua b/test/functional/vimscript/match_functions_spec.lua
index 87c57f1c15..46c876da99 100644
--- a/test/functional/vimscript/match_functions_spec.lua
+++ b/test/functional/vimscript/match_functions_spec.lua
@@ -174,7 +174,6 @@ describe('matchaddpos()', function()
end)
it('works with zero length', function()
local screen = Screen.new(40, 5)
- screen:attach()
fn.setline(1, 'abcdef')
command('hi PreProc guifg=Red')
eq(4, fn.matchaddpos('PreProc', { { 1, 2, 0 } }, 3, 4))
diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua
index 792e4c46c3..b5c4972d7b 100644
--- a/test/functional/vimscript/system_spec.lua
+++ b/test/functional/vimscript/system_spec.lua
@@ -132,7 +132,6 @@ describe('system()', function()
before_each(function()
screen = Screen.new()
- screen:attach()
end)
if is_os('win') then
@@ -430,11 +429,6 @@ describe('systemlist()', function()
before_each(function()
screen = Screen.new()
- screen:attach()
- end)
-
- after_each(function()
- screen:detach()
end)
it('`echo` and waits for its return', function()
@@ -567,7 +561,6 @@ describe('shell :!', function()
it(':{range}! with powershell filter/redirect #16271 #19250', function()
local screen = Screen.new(500, 8)
- screen:attach()
local found = n.set_shell_powershell(true)
insert([[
3
@@ -598,7 +591,6 @@ describe('shell :!', function()
it(':{range}! without redirecting to buffer', function()
local screen = Screen.new(500, 10)
- screen:attach()
insert([[
3
1
diff --git a/test/functional/vimscript/timer_spec.lua b/test/functional/vimscript/timer_spec.lua
index f075e382bc..d1b8bfe5d9 100644
--- a/test/functional/vimscript/timer_spec.lua
+++ b/test/functional/vimscript/timer_spec.lua
@@ -108,10 +108,6 @@ describe('timers', function()
it('can invoke redraw in blocking getchar() call', function()
local screen = Screen.new(40, 6)
- screen:attach()
- screen:set_default_attr_ids({
- [1] = { bold = true, foreground = Screen.colors.Blue },
- })
api.nvim_buf_set_lines(0, 0, -1, true, { 'ITEM 1', 'ITEM 2' })
source([[
@@ -228,8 +224,6 @@ describe('timers', function()
it("doesn't mess up the cmdline", function()
local screen = Screen.new(40, 6)
- screen:attach()
- screen:set_default_attr_ids({ [0] = { bold = true, foreground = 255 } })
source([[
let g:val = 0
func! MyHandler(timer)
@@ -247,7 +241,7 @@ describe('timers', function()
feed(':good')
screen:expect([[
|
- {0:~ }|*4
+ {1:~ }|*4
:good^ |
]])
command('let g:val = 1')
@@ -267,7 +261,6 @@ describe('timers', function()
it('can be triggered after an empty string <expr> mapping #17257', function()
local screen = Screen.new(40, 6)
- screen:attach()
command([=[imap <expr> <F2> [timer_start(0, { _ -> execute("throw 'x'", "") }), ''][-1]]=])
feed('i<F2>')
screen:expect({ any = 'E605: Exception not caught: x' })