mirror of
https://github.com/neovim/neovim.git
synced 2026-04-25 08:44:06 +00:00
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.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user