aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds
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/ex_cmds
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/ex_cmds')
-rw-r--r--test/functional/ex_cmds/script_spec.lua5
-rw-r--r--test/functional/ex_cmds/source_spec.lua20
-rw-r--r--test/functional/ex_cmds/verbose_spec.lua2
3 files changed, 14 insertions, 13 deletions
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index d13268c97c..62249caa5e 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local neq = helpers.neq
local command = helpers.command
+local exec_capture = helpers.exec_capture
local write_file = helpers.write_file
local meths = helpers.meths
local clear = helpers.clear
@@ -34,7 +35,7 @@ describe('script_get-based command', function()
%s %s
endif
]])):format(cmd, garbage)))
- eq('', meths.exec2('messages', { output = true }).output)
+ eq('', exec_capture('messages'))
if check_neq then
neq(0, exc_exec(dedent([[
%s %s
@@ -49,7 +50,7 @@ describe('script_get-based command', function()
EOF
endif
]])):format(cmd, garbage)))
- eq('', meths.exec2('messages', { output = true }).output)
+ eq('', exec_capture('messages'))
if check_neq then
eq(true, pcall(source, (dedent([[
let g:exc = 0
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua
index e12ead240d..41045f5cb4 100644
--- a/test/functional/ex_cmds/source_spec.lua
+++ b/test/functional/ex_cmds/source_spec.lua
@@ -96,12 +96,12 @@ describe(':source', function()
let d = s:s]])
command('source')
- eq('2', meths.exec2('echo a', { output = true }).output)
- eq("{'k': 'v'}", meths.exec2('echo b', { output = true }).output)
+ eq('2', exec_capture('echo a'))
+ eq("{'k': 'v'}", exec_capture('echo b'))
-- Script items are created only on script var access
- eq("1", meths.exec2('echo c', { output = true }).output)
- eq("0zBEEFCAFE", meths.exec2('echo d', { output = true }).output)
+ eq("1", exec_capture('echo c'))
+ eq("0zBEEFCAFE", exec_capture('echo d'))
exec('set cpoptions+=C')
eq('Vim(let):E723: Missing end of Dictionary \'}\': ', exc_exec('source'))
@@ -124,14 +124,14 @@ describe(':source', function()
-- Source the 2nd line only
feed('ggjV')
feed_command(':source')
- eq('3', meths.exec2('echo a', { output = true }).output)
+ eq('3', exec_capture('echo a'))
-- Source from 2nd line to end of file
feed('ggjVG')
feed_command(':source')
- eq('4', meths.exec2('echo a', { output = true }).output)
- eq("{'K': 'V'}", meths.exec2('echo b', { output = true }).output)
- eq("<SNR>1_C()", meths.exec2('echo D()', { output = true }).output)
+ eq('4', exec_capture('echo a'))
+ eq("{'K': 'V'}", exec_capture('echo b'))
+ eq("<SNR>1_C()", exec_capture('echo D()'))
-- Source last line only
feed_command(':$source')
@@ -147,7 +147,7 @@ describe(':source', function()
let a = 123
]]
command('source')
- eq('123', meths.exec2('echo a', { output = true }).output)
+ eq('123', exec_capture('echo a'))
end)
it('multiline heredoc command', function()
@@ -157,7 +157,7 @@ describe(':source', function()
EOF]])
command('source')
- eq('4', meths.exec2('echo luaeval("y")', { output = true }).output)
+ eq('4', exec_capture('echo luaeval("y")'))
end)
it('can source lua files', function()
diff --git a/test/functional/ex_cmds/verbose_spec.lua b/test/functional/ex_cmds/verbose_spec.lua
index 2482fd912f..def09e2f9e 100644
--- a/test/functional/ex_cmds/verbose_spec.lua
+++ b/test/functional/ex_cmds/verbose_spec.lua
@@ -28,7 +28,7 @@ vim.api.nvim_exec2("augroup test_group\
autocmd!\
autocmd FileType c setl cindent\
augroup END\
- ", { output = false })
+ ", {})
vim.api.nvim_command("command Bdelete :bd")
vim.api.nvim_create_user_command("TestCommand", ":echo 'Hello'", {})