2024-04-09 04:26:16 -07:00
|
|
|
local t = require('test.unit.testutil')
|
2024-04-08 02:03:20 -07:00
|
|
|
local t_eval = require('test.unit.eval.testutil')
|
2017-03-13 04:35:53 -07:00
|
|
|
|
2024-04-08 02:03:20 -07:00
|
|
|
local itp = t.gen_itp(it)
|
2016-04-03 18:53:07 -07:00
|
|
|
|
2024-04-08 02:03:20 -07:00
|
|
|
local cimport = t.cimport
|
|
|
|
local eq = t.eq
|
2016-04-03 18:53:07 -07:00
|
|
|
|
2024-04-08 02:03:20 -07:00
|
|
|
local eval0 = t_eval.eval0
|
2017-03-13 04:35:53 -07:00
|
|
|
|
2023-12-04 15:32:39 -07:00
|
|
|
local eval = cimport('./src/nvim/eval.h', './src/nvim/eval/typval.h', './src/nvim/memory.h')
|
2016-04-03 18:53:07 -07:00
|
|
|
|
|
|
|
describe('NULL typval_T', function()
|
2017-03-04 18:02:45 -07:00
|
|
|
itp('is produced by $XXX_UNEXISTENT_VAR_XXX', function()
|
2016-04-03 18:53:07 -07:00
|
|
|
-- Required for various tests which need to check whether typval_T with NULL
|
|
|
|
-- string works correctly. This test checks that unexistent environment
|
|
|
|
-- variable produces NULL string, not that some specific environment
|
|
|
|
-- variable does not exist. Last bit is left for the test writers.
|
|
|
|
local unexistent_env = 'XXX_UNEXISTENT_VAR_XXX'
|
|
|
|
while os.getenv(unexistent_env) ~= nil do
|
|
|
|
unexistent_env = unexistent_env .. '_XXX'
|
|
|
|
end
|
2016-09-03 16:50:50 -07:00
|
|
|
local rettv = eval0('$' .. unexistent_env)
|
2016-04-03 18:53:07 -07:00
|
|
|
eq(eval.VAR_STRING, rettv.v_type)
|
|
|
|
eq(nil, rettv.vval.v_string)
|
|
|
|
end)
|
|
|
|
|
2017-03-04 18:02:45 -07:00
|
|
|
itp('is produced by v:_null_list', function()
|
2016-09-03 16:50:50 -07:00
|
|
|
local rettv = eval0('v:_null_list')
|
2016-04-03 18:53:07 -07:00
|
|
|
eq(eval.VAR_LIST, rettv.v_type)
|
|
|
|
eq(nil, rettv.vval.v_list)
|
|
|
|
end)
|
|
|
|
|
2017-03-04 18:02:45 -07:00
|
|
|
itp('is produced by v:_null_dict', function()
|
2016-09-03 16:50:50 -07:00
|
|
|
local rettv = eval0('v:_null_dict')
|
2016-04-03 18:53:07 -07:00
|
|
|
eq(eval.VAR_DICT, rettv.v_type)
|
|
|
|
eq(nil, rettv.vval.v_dict)
|
|
|
|
end)
|
|
|
|
end)
|