From f1ced96c28b7db7b3dad9b0ca2f71f8d046ef732 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 11 Feb 2016 02:01:17 +0300 Subject: api: Replace set_var(name, NIL) with del_var(name) --- test/functional/api/vim_spec.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test/functional/api/vim_spec.lua') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 699a0bd588..d7faaa9d2d 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -4,6 +4,8 @@ local Screen = require('test.functional.ui.screen') local clear, nvim, eq, neq = helpers.clear, helpers.nvim, helpers.eq, helpers.neq local ok, nvim_async, feed = helpers.ok, helpers.nvim_async, helpers.feed local os_name = helpers.os_name +local meths = helpers.meths +local funcs = helpers.funcs describe('vim_* functions', function() before_each(clear) @@ -70,11 +72,14 @@ describe('vim_* functions', function() end) end) - describe('{get,set}_var', function() + describe('{get,set,del}_var', function() it('works', function() nvim('set_var', 'lua', {1, 2, {['3'] = 1}}) eq({1, 2, {['3'] = 1}}, nvim('get_var', 'lua')) eq({1, 2, {['3'] = 1}}, nvim('eval', 'g:lua')) + eq(1, funcs.exists('g:lua')) + meths.del_var('lua') + eq(0, funcs.exists('g:lua')) end) it('set_var returns the old value', function() @@ -84,6 +89,14 @@ describe('vim_* functions', function() eq(val1, nvim('set_var', 'lua', val2)) end) + it('del_var returns the old value', function() + local val1 = {1, 2, {['3'] = 1}} + local val2 = {4, 7} + eq(nil, meths.set_var('lua', val1)) + eq(val1, meths.set_var('lua', val2)) + eq(val2, meths.del_var('lua')) + end) + it('truncates values with NULs in them', function() nvim('set_var', 'xxx', 'ab\0cd') eq('ab', nvim('get_var', 'xxx')) -- cgit From a64114eba017c0db3d1849186c9c54fb09308761 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 18 Apr 2016 01:37:21 +0300 Subject: functests: Make json_functions_spec use new NIL where appropriate --- test/functional/api/vim_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/api/vim_spec.lua') diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index d7faaa9d2d..389badb423 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -92,7 +92,7 @@ describe('vim_* functions', function() it('del_var returns the old value', function() local val1 = {1, 2, {['3'] = 1}} local val2 = {4, 7} - eq(nil, meths.set_var('lua', val1)) + eq(NIL, meths.set_var('lua', val1)) eq(val1, meths.set_var('lua', val2)) eq(val2, meths.del_var('lua')) end) -- cgit