summaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2020-09-06 10:34:44 -0700
committerGitHub <noreply@github.com>2020-09-06 10:34:44 -0700
commitd9dd30a955073d602741481d48e1c56d1fcae420 (patch)
tree586c14820bc373568db0d9660583d0958f1d6d0f /test
parentc685a2ef487ebfffeb93274eee79d29c7e6bd6d1 (diff)
parentb2cef8b6650627f65c43029645942d46103a77df (diff)
Merge #12822 release-0.4 patchesrelease-0.4
Diffstat (limited to 'test')
-rw-r--r--test/functional/helpers.lua15
-rw-r--r--test/functional/terminal/buffer_spec.lua9
-rw-r--r--test/functional/ui/output_spec.lua16
3 files changed, 38 insertions, 2 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index bd36bac062..dbaedd6f60 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -500,9 +500,20 @@ function module.source(code)
end
function module.set_shell_powershell()
+ local shell = iswin() and 'powershell' or 'pwsh'
+ if not module.eval('executable("'..shell..'")') then
+ error(shell..' is not executable')
+ end
+ local aliases = iswin() and {'cat', 'sleep'} or {}
+ local cmd = ''
+ for _, alias in ipairs(aliases) do
+ cmd = cmd .. 'Remove-Item -Force alias:' .. alias .. ';'
+ end
module.source([[
- set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
- let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep; Remove-Item -Force alias:cat;'
+ let &shell = ']]..shell..[['
+ set shellquote= shellpipe=\| shellxquote=
+ let &shellredir = '| Out-File -Encoding UTF8'
+ let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ]]..cmd..[['
]])
end
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index c6ea0c0e6b..fb6e0d0e94 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -264,3 +264,12 @@ describe('No heap-buffer-overflow when using', function()
feed_command('bdelete!')
end)
end)
+
+describe('No heap-buffer-overflow when', function()
+ it('set nowrap and send long line #11548', function()
+ feed_command('set nowrap')
+ feed_command('autocmd TermOpen * startinsert')
+ feed_command('call feedkeys("4000ai\\<esc>:terminal!\\<cr>")')
+ eq(2, eval('1+1'))
+ end)
+end)
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index c028f44b44..c5d3e536ad 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -10,6 +10,7 @@ local iswin = helpers.iswin
local clear = helpers.clear
local command = helpers.command
local nvim_dir = helpers.nvim_dir
+local set_shell_powershell = helpers.set_shell_powershell
describe("shell command :!", function()
local screen
@@ -230,4 +231,19 @@ describe("shell command :!", function()
]])
end)
end)
+ if iswin() or eval('executable("pwsh")') == 1 then
+ it('powershell supports literal strings', function()
+ set_shell_powershell()
+ local screen = Screen.new(30, 4)
+ screen:attach()
+ feed_command([[!'echo $a']])
+ screen:expect{any='\necho %$a', timeout=10000}
+ feed_command([[!$a = 1; echo '$a']])
+ screen:expect{any='\n%$a', timeout=10000}
+ feed_command([[!"echo $a"]])
+ screen:expect{any='\necho', timeout=10000}
+ feed_command([[!$a = 1; echo "$a"]])
+ screen:expect{any='\n1', timeout=10000}
+ end)
+ end
end)