aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-03-26 10:49:32 +0800
committerGitHub <noreply@github.com>2023-03-26 10:49:32 +0800
commit4863ca6b8902c5b0aab95f2af640118cd417d379 (patch)
tree41a1ecb32984dc88f25df722abaf3ba381db3cf3 /test/functional/ui
parent4eef5ac453866dae7c03f5432fc8c4dfcda19f54 (diff)
downloadrneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.tar.gz
rneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.tar.bz2
rneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.zip
test: use exec_capture() in more places (#22787)
Problem: Using `meths.exec2("code", { output = true })` is too verbose. Solution: Use exec_capture() in more places.
Diffstat (limited to 'test/functional/ui')
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua9
-rw-r--r--test/functional/ui/messages_spec.lua5
2 files changed, 8 insertions, 6 deletions
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index d6c8408f04..783246c6e4 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -7,6 +7,7 @@ local clear = helpers.clear
local meths = helpers.meths
local funcs = helpers.funcs
local source = helpers.source
+local exec_capture = helpers.exec_capture
local dedent = helpers.dedent
local command = helpers.command
local curbufmeths = helpers.curbufmeths
@@ -362,7 +363,7 @@ describe('Command-line coloring', function()
{EOB:~ }|
:e^ |
]])
- eq('', meths.exec2('messages', { output = true }).output)
+ eq('', exec_capture('messages'))
end)
it('silences :echon', function()
set_color_cb('Echoning')
@@ -377,7 +378,7 @@ describe('Command-line coloring', function()
{EOB:~ }|
:e^ |
]])
- eq('', meths.exec2('messages', { output = true }).output)
+ eq('', exec_capture('messages'))
end)
it('silences :echomsg', function()
set_color_cb('Echomsging')
@@ -392,7 +393,7 @@ describe('Command-line coloring', function()
{EOB:~ }|
:e^ |
]])
- eq('', meths.exec2('messages', { output = true }).output)
+ eq('', exec_capture('messages'))
end)
it('does the right thing when throwing', function()
set_color_cb('Throwing')
@@ -858,7 +859,7 @@ describe('Ex commands coloring', function()
]])
feed('<CR>')
eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: empty buffer',
- meths.exec2('messages', { output = true }).output)
+ exec_capture('messages'))
end)
it('errors out when failing to get callback', function()
meths.set_var('Nvim_color_cmdline', 42)
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
index 81602ef92e..5220f3fa89 100644
--- a/test/functional/ui/messages_spec.lua
+++ b/test/functional/ui/messages_spec.lua
@@ -10,6 +10,7 @@ local async_meths = helpers.async_meths
local test_build_dir = helpers.test_build_dir
local nvim_prog = helpers.nvim_prog
local exec = helpers.exec
+local exec_capture = helpers.exec_capture
local exc_exec = helpers.exc_exec
local exec_lua = helpers.exec_lua
local poke_eventloop = helpers.poke_eventloop
@@ -986,7 +987,7 @@ describe('ui/builtin messages', function()
-- screen size doesn't affect internal output #10285
eq('ErrorMsg xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red',
- meths.exec2("hi ErrorMsg", { output = true }).output)
+ exec_capture("hi ErrorMsg"))
end)
it(':syntax list langGroup output', function()
@@ -1025,7 +1026,7 @@ vimComment xxx match /\s"[^\-:.%#=*].*$/ms=s+1,lc=1 excludenl contains=@vim
match /\<endif\s\+".*$/ms=s+5,lc=5 contains=@vimCommentGroup,vimCommentString
match /\<else\s\+".*$/ms=s+4,lc=4 contains=@vimCommentGroup,vimCommentString
links to Comment]],
- meths.exec2('syntax list vimComment', { output = true }).output)
+ exec_capture('syntax list vimComment'))
-- luacheck: pop
end)