aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2026-10-06 14:33:55 +0200
committerGitHub <noreply@github.com>2026-10-06 14:33:55 +0200
commitcae3a197f74d1f406319ef00a0d2080d98322a00 (patch)
treec34958404b03cdc46207f3beb932dd8f60a6cd1b /test
parent501dda72aa110adae71ac46bd775bf49d569214a (diff)
parentadc0700dc4589e59de2c17a2f8cfc2ba2fb1181f (diff)
downloadrneovim-cae3a197f74d1f406319ef00a0d2080d98322a00.tar.gz
rneovim-cae3a197f74d1f406319ef00a0d2080d98322a00.tar.bz2
rneovim-cae3a197f74d1f406319ef00a0d2080d98322a00.zip
Merge pull request #42217 from bfredl/redirecting
fix(lua): regression with `print()` in headless mode when redirecting
Diffstat (limited to 'test')
-rw-r--r--test/functional/core/startup_spec.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua
index 8761dd60fb..cc13d6aacd 100644
--- a/test/functional/core/startup_spec.lua
+++ b/test/functional/core/startup_spec.lua
@@ -398,6 +398,42 @@ describe('startup', function()
eq(('A'):rep(1234) .. '\n' .. ('B'):rep(1234) .. '\n' .. ('C'):rep(1234) .. '\n', out)
end)
+ it('nvim_exec2 can capture Lua print() message with --headless', function()
+ local out = fn.system({
+ nvim_prog,
+ '-u',
+ 'NONE',
+ '-i',
+ 'NONE',
+ '--headless',
+ '-c',
+ [[let x = nvim_exec2("lua print 'hello:3'", #{output: v:true})]],
+ '-c',
+ "echomsg 'captured: <'.x.output.'>'",
+ '+q',
+ })
+
+ eq('captured: <hello:3>', out)
+ end)
+
+ it('screenstring() affected by Lua print() message with --headless', function()
+ local out = fn.system({
+ nvim_prog,
+ '-u',
+ 'NONE',
+ '-i',
+ 'NONE',
+ '--headless',
+ '-c',
+ 'lua print "ö"',
+ '-c',
+ "echomsg 'screen at the time: '..screenstring(24,1)",
+ '+q',
+ })
+
+ eq('ö\nscreen at the time: ö', out)
+ end)
+
it('pipe at both ends: has("ttyin")==0 has("ttyout")==0', function()
-- system() puts a pipe at both ends.
local out = fn.system({