aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/channel_spec.lua
diff options
context:
space:
mode:
authorEnan Ajmain <3nan.ajmain@gmail.com>2022-12-09 02:55:50 +0600
committerGitHub <noreply@github.com>2022-12-08 12:55:50 -0800
commit1e2cc688891c789f02699f9c7e0bffd435794310 (patch)
treea966336897d3a1668e51d299ed3b0413da861712 /test/functional/terminal/channel_spec.lua
parent9b2c79034416c9a1b105f796b761a0d4a2a06ea1 (diff)
downloadrneovim-1e2cc688891c789f02699f9c7e0bffd435794310.tar.gz
rneovim-1e2cc688891c789f02699f9c7e0bffd435794310.tar.bz2
rneovim-1e2cc688891c789f02699f9c7e0bffd435794310.zip
fix(chansend): sending lines to terminal in reverse order on Windows #19315
Problem: `chansend()` on Windows sends lines in reverse order. Cause: Using \n instead of \r\n for newlines on Windows. Solution: on Windows, use CRLF newline characters. Fixes #18501
Diffstat (limited to 'test/functional/terminal/channel_spec.lua')
-rw-r--r--test/functional/terminal/channel_spec.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/terminal/channel_spec.lua b/test/functional/terminal/channel_spec.lua
index b5f3c2bd31..2ca7cdb0a2 100644
--- a/test/functional/terminal/channel_spec.lua
+++ b/test/functional/terminal/channel_spec.lua
@@ -7,6 +7,7 @@ local command = helpers.command
local pcall_err = helpers.pcall_err
local feed = helpers.feed
local poke_eventloop = helpers.poke_eventloop
+local is_os = helpers.is_os
describe('terminal channel is closed and later released if', function()
local screen
@@ -92,3 +93,17 @@ describe('terminal channel is closed and later released if', function()
eq(chans - 1, eval('len(nvim_list_chans())'))
end)
end)
+
+it('chansend sends lines to terminal channel in proper order', function()
+ clear()
+ local screen = Screen.new(100, 20)
+ screen:attach()
+ local shells = is_os('win') and {'cmd.exe', 'pwsh.exe -nop', 'powershell.exe -nop'} or {'sh'}
+ for _, sh in ipairs(shells) do
+ command([[bdelete! | let id = termopen(']] .. sh .. [[')]])
+ command([[call chansend(id, ['echo "hello"', 'echo "world"', ''])]])
+ screen:expect{
+ any=[[echo "hello".*echo "world"]]
+ }
+ end
+end)