aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-08-03 00:08:17 -0600
commit9449e1b8d273ff78eb894c588110ffa0c17d6ee3 (patch)
tree9e4470c33bd4187d9f42f0b2c4aaa995310c5be8 /test/functional/vimscript
parent308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (diff)
parentb8dcbcc732baf84fc48d6b272c3ade0bcb129b3b (diff)
downloadrneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.gz
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.tar.bz2
rneovim-9449e1b8d273ff78eb894c588110ffa0c17d6ee3.zip
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'test/functional/vimscript')
-rw-r--r--test/functional/vimscript/buf_functions_spec.lua4
-rw-r--r--test/functional/vimscript/let_spec.lua3
-rw-r--r--test/functional/vimscript/map_functions_spec.lua34
-rw-r--r--test/functional/vimscript/system_spec.lua23
4 files changed, 55 insertions, 9 deletions
diff --git a/test/functional/vimscript/buf_functions_spec.lua b/test/functional/vimscript/buf_functions_spec.lua
index e957e5f5af..b521620320 100644
--- a/test/functional/vimscript/buf_functions_spec.lua
+++ b/test/functional/vimscript/buf_functions_spec.lua
@@ -303,4 +303,8 @@ describe('setbufvar() function', function()
pcall_err(funcs.setbufvar, 1, 'changedtick', true))
eq(2, funcs.getbufvar(1, 'changedtick'))
end)
+ it('throws error when setting a string option to a boolean value vim-patch:9.0.0090', function()
+ eq('Vim:E928: String required',
+ pcall_err(funcs.setbufvar, '', '&errorformat', true))
+ end)
end)
diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua
index ca1b5e8907..86905199a8 100644
--- a/test/functional/vimscript/let_spec.lua
+++ b/test/functional/vimscript/let_spec.lua
@@ -7,6 +7,7 @@ local eval = helpers.eval
local meths = helpers.meths
local exec = helpers.exec
local exec_capture = helpers.exec_capture
+local expect_exit = helpers.expect_exit
local source = helpers.source
local testprg = helpers.testprg
@@ -28,7 +29,7 @@ describe(':let', function()
it(":unlet self-referencing node in a List graph #6070", function()
-- :unlet-ing a self-referencing List must not allow GC on indirectly
-- referenced in-scope Lists. Before #6070 this caused use-after-free.
- source([=[
+ expect_exit(100, source, [=[
let [l1, l2] = [[], []]
echo 'l1:' . id(l1)
echo 'l2:' . id(l2)
diff --git a/test/functional/vimscript/map_functions_spec.lua b/test/functional/vimscript/map_functions_spec.lua
index 275c72d212..aa64006de0 100644
--- a/test/functional/vimscript/map_functions_spec.lua
+++ b/test/functional/vimscript/map_functions_spec.lua
@@ -3,7 +3,10 @@ local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local eval = helpers.eval
+local expect = helpers.expect
+local feed = helpers.feed
local funcs = helpers.funcs
+local meths = helpers.meths
local nvim = helpers.nvim
local source = helpers.source
local command = helpers.command
@@ -13,6 +16,7 @@ describe('maparg()', function()
local foo_bar_map_table = {
lhs='foo',
+ lhsraw='foo',
script=0,
silent=0,
rhs='bar',
@@ -141,6 +145,7 @@ describe('maparg()', function()
local function acmap(lhs, rhs)
return {
lhs = ac(lhs),
+ lhsraw = ac(lhs),
rhs = ac(rhs),
buffer = 0,
@@ -161,3 +166,32 @@ describe('maparg()', function()
eq(acmap('e`', 'f`'), funcs.maparg(ac('e`'), 'n', 0, 1))
end)
end)
+
+describe('mapset()', function()
+ before_each(clear)
+
+ it('can restore mapping description from the dict returned by maparg()', function()
+ meths.set_keymap('n', 'lhs', 'rhs', {desc = 'map description'})
+ eq('\nn lhs rhs\n map description',
+ helpers.exec_capture("nmap lhs"))
+ local mapargs = funcs.maparg('lhs', 'n', false, true)
+ meths.del_keymap('n', 'lhs')
+ eq('\nNo mapping found', helpers.exec_capture("nmap lhs"))
+ funcs.mapset('n', false, mapargs)
+ eq('\nn lhs rhs\n map description',
+ helpers.exec_capture("nmap lhs"))
+ end)
+
+ it('can restore "replace_keycodes" from the dict returned by maparg()', function()
+ meths.set_keymap('i', 'foo', [['<l' .. 't>']], {expr = true, replace_keycodes = true})
+ feed('Afoo')
+ expect('<')
+ local mapargs = funcs.maparg('foo', 'i', false, true)
+ meths.set_keymap('i', 'foo', [['<l' .. 't>']], {expr = true})
+ feed('foo')
+ expect('<<lt>')
+ funcs.mapset('i', false, mapargs)
+ feed('foo')
+ expect('<<lt><')
+ end)
+end)
diff --git a/test/functional/vimscript/system_spec.lua b/test/functional/vimscript/system_spec.lua
index c915556c57..a778e2f435 100644
--- a/test/functional/vimscript/system_spec.lua
+++ b/test/functional/vimscript/system_spec.lua
@@ -630,7 +630,7 @@ end)
describe('shell :!', function()
before_each(clear)
- it(':{range}! with powershell filter/redirect #16271', function()
+ it(':{range}! with powershell filter/redirect #16271 #19250', function()
local screen = Screen.new(500, 8)
screen:attach()
local found = helpers.set_shell_powershell(true)
@@ -639,18 +639,25 @@ describe('shell :!', function()
1
4
2]])
- feed(':4verbose %!sort<cr>')
- screen:expect{
- any=[[Executing command: .?Start%-Process sort %-RedirectStandardInput .* %-RedirectStandardOutput .* %-NoNewWindow %-Wait]]
- }
+ if iswin() then
+ feed(':4verbose %!sort /R<cr>')
+ screen:expect{
+ any=[[Executing command: .?Start%-Process sort %-ArgumentList "/R" %-RedirectStandardInput .* %-RedirectStandardOutput .* %-NoNewWindow %-Wait]]
+ }
+ else
+ feed(':4verbose %!sort -r<cr>')
+ screen:expect{
+ any=[[Executing command: .?Start%-Process sort %-ArgumentList "%-r" %-RedirectStandardInput .* %-RedirectStandardOutput .* %-NoNewWindow %-Wait]]
+ }
+ end
feed('<CR>')
if found then
-- Not using fake powershell, so we can test the result.
expect([[
- 1
- 2
+ 4
3
- 4]])
+ 2
+ 1]])
end
end)
end)