mirror of
https://github.com/neovim/neovim.git
synced 2025-12-09 16:12:48 +00:00
fixup! unittests: Add tests for vim_to_object function
This commit is contained in:
@@ -9,6 +9,7 @@ local eq = helpers.eq
|
||||
local lua2typvalt = eval_helpers.lua2typvalt
|
||||
local typvalt = eval_helpers.typvalt
|
||||
|
||||
local nil_value = api_helpers.nil_value
|
||||
local list_type = api_helpers.list_type
|
||||
local int_type = api_helpers.int_type
|
||||
local type_key = api_helpers.type_key
|
||||
@@ -33,7 +34,7 @@ describe('vim_to_object', function()
|
||||
|
||||
simple_test('converts true', true)
|
||||
simple_test('converts false', false)
|
||||
simple_test('converts nil', NIL)
|
||||
simple_test('converts nil', nil_value)
|
||||
simple_test('converts 1', 1)
|
||||
simple_test('converts -1.5', -1.5)
|
||||
simple_test('converts empty string', '')
|
||||
@@ -48,30 +49,30 @@ describe('vim_to_object', function()
|
||||
|
||||
local dct = {}
|
||||
dct.dct = dct
|
||||
different_output_test('outputs nil for nested dictionaries (1 level)', dct, {dct=NIL})
|
||||
different_output_test('outputs nil for nested dictionaries (1 level)', dct, {dct=nil_value})
|
||||
|
||||
local lst = {}
|
||||
lst[1] = lst
|
||||
different_output_test('outputs nil for nested lists (1 level)', lst, {NIL})
|
||||
different_output_test('outputs nil for nested lists (1 level)', lst, {nil_value})
|
||||
|
||||
local dct2 = {test=true, dict=NIL}
|
||||
local dct2 = {test=true, dict=nil_value}
|
||||
dct2.dct = {dct2}
|
||||
different_output_test('outputs nil for nested dictionaries (2 level, in list)',
|
||||
dct2, {dct={NIL}, test=true, dict=NIL})
|
||||
dct2, {dct={nil_value}, test=true, dict=nil_value})
|
||||
|
||||
local dct3 = {test=true, dict=NIL}
|
||||
local dct3 = {test=true, dict=nil_value}
|
||||
dct3.dct = {dctin=dct3}
|
||||
different_output_test('outputs nil for nested dictionaries (2 level, in dict)',
|
||||
dct3, {dct={dctin=NIL}, test=true, dict=NIL})
|
||||
dct3, {dct={dctin=nil_value}, test=true, dict=nil_value})
|
||||
|
||||
local lst2 = {}
|
||||
lst2[1] = {lst2}
|
||||
different_output_test('outputs nil for nested lists (2 level, in list)', lst2, {{NIL}})
|
||||
different_output_test('outputs nil for nested lists (2 level, in list)', lst2, {{nil_value}})
|
||||
|
||||
local lst3 = {nil, true, false, 'ttest'}
|
||||
lst3[1] = {lst=lst3}
|
||||
different_output_test('outputs nil for nested lists (2 level, in dict)',
|
||||
lst3, {{lst=NIL}, true, false, 'ttest'})
|
||||
lst3, {{lst=nil_value}, true, false, 'ttest'})
|
||||
|
||||
it('outputs empty list for NULL list', function()
|
||||
local tt = typvalt('VAR_LIST', {v_list=NULL})
|
||||
|
||||
Reference in New Issue
Block a user