From d60412b18e4e21f301baa2ac3f3fb7be89655e4b Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 12 Feb 2024 20:40:27 +0100 Subject: refactor(eval): use arena when converting typvals to Object Note: this contains two _temporary_ changes which can be reverted once the Arena vs no-Arena distinction in API wrappers has been removed. Both nlua_push_Object and object_to_vim_take_luaref() has been changed to take the object argument as a pointer. This is not going to be necessary once these are only used with arena (or not at all) allocated Objects. The object_to_vim() variant which leaves luaref untouched might need to stay for a little longer. --- test/unit/api/private_helpers_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/unit/api/private_helpers_spec.lua') diff --git a/test/unit/api/private_helpers_spec.lua b/test/unit/api/private_helpers_spec.lua index 80ca9ddc5b..9843bd5c9e 100644 --- a/test/unit/api/private_helpers_spec.lua +++ b/test/unit/api/private_helpers_spec.lua @@ -22,7 +22,7 @@ local api = cimport('./src/nvim/api/private/helpers.h', './src/nvim/api/private/ describe('vim_to_object', function() local vim_to_object = function(l) - return obj2lua(api.vim_to_object(lua2typvalt(l))) + return obj2lua(api.vim_to_object(lua2typvalt(l), nil, false)) end local different_output_test = function(name, input, output) @@ -92,13 +92,13 @@ describe('vim_to_object', function() itp('outputs empty list for NULL list', function() local tt = typvalt('VAR_LIST', { v_list = NULL }) eq(nil, tt.vval.v_list) - eq({ [type_key] = list_type }, obj2lua(api.vim_to_object(tt))) + eq({ [type_key] = list_type }, obj2lua(api.vim_to_object(tt, nil, false))) end) itp('outputs empty dict for NULL dict', function() local tt = typvalt('VAR_DICT', { v_dict = NULL }) eq(nil, tt.vval.v_dict) - eq({}, obj2lua(api.vim_to_object(tt))) + eq({}, obj2lua(api.vim_to_object(tt, nil, false))) end) itp('regression: partials in a list', function() @@ -113,6 +113,6 @@ describe('vim_to_object', function() } local list = lua2typvalt(llist) eq(llist, typvalt2lua(list)) - eq({ nil_value, {} }, obj2lua(api.vim_to_object(list))) + eq({ nil_value, {} }, obj2lua(api.vim_to_object(list, nil, false))) end) end) -- cgit