aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/eval_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy/eval_spec.lua')
-rw-r--r--test/functional/legacy/eval_spec.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua
index d1ed96cc2e..3ff1092a4b 100644
--- a/test/functional/legacy/eval_spec.lua
+++ b/test/functional/legacy/eval_spec.lua
@@ -495,6 +495,28 @@ describe('eval', function()
' abcE4b10-4\000abcE4b10-4-2')
end)
+ it('getreg("a",1,1) returns a valid list when "a is unset', function()
+ -- Precondition: "a is actually unset and "0 is nonempty
+ eq('', eval("getregtype('a')"))
+ eq('', eval("getreg('a')"))
+ execute("call setreg('0','text')")
+
+ -- This used to return a NULL list
+ -- which setreg didn't handle
+ execute("let x = getreg('a',1,1)")
+ execute("call setreg('0',x)")
+
+ -- nvim didn't crash and "0 was emptied
+ eq(2, eval("1+1"))
+ eq({}, eval("getreg('0',1,1)"))
+
+ -- x is a mutable list
+ execute("let y = x")
+ eq({}, eval("y"))
+ execute("call add(x, 'item')")
+ eq({'item'}, eval("y"))
+ end)
+
it('search and expressions', function()
execute('so test_eval_setup.vim')
execute([=[call SetReg('/', ['abc/'])]=])