From 858ac9d8e5d971db3d6f770d386fc964187a78b4 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 23 Feb 2017 01:34:25 +0300 Subject: api: Make sure dict_set_var doesn’t edit read-only values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #6147 --- test/functional/api/window_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/functional/api/window_spec.lua') diff --git a/test/functional/api/window_spec.lua b/test/functional/api/window_spec.lua index 465bda6bc9..deffc68994 100644 --- a/test/functional/api/window_spec.lua +++ b/test/functional/api/window_spec.lua @@ -8,6 +8,8 @@ local curwinmeths = helpers.curwinmeths local funcs = helpers.funcs local request = helpers.request local NIL = helpers.NIL +local meth_pcall = helpers.meth_pcall +local command = helpers.command -- check if str is visible at the beginning of some line local function is_visible(str) @@ -137,6 +139,11 @@ describe('api/win', function() eq(1, funcs.exists('w:lua')) curwinmeths.del_var('lua') eq(0, funcs.exists('w:lua')) + eq({false, 'Key "lua" doesn\'t exist'}, meth_pcall(curwinmeths.del_var, 'lua')) + curwinmeths.set_var('lua', 1) + command('lockvar w:lua') + eq({false, 'Key is locked: lua'}, meth_pcall(curwinmeths.del_var, 'lua')) + eq({false, 'Key is locked: lua'}, meth_pcall(curwinmeths.set_var, 'lua', 1)) end) it('window_set_var returns the old value', function() -- cgit