robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.unit.testutil' ) 2local t_eval =require ( 'test.unit.eval.testutil' ) 3 4local describe =t . describe 5local itp =t . gen_itp ( t . it ) 6 7local cimport =t . cimport 8local eq =t . eq 9 10local eval0 =t_eval . eval0 11 12local eval =cimport ( './src/nvim/eval.h' , './src/nvim/eval/typval.h' , './src/nvim/memory.h' ) 13 14describe ( 'NULL typval_T' , function () 15itp ( 'is produced by $XXX_UNEXISTENT_VAR_XXX' , function () 16-- Required for various tests which need to check whether typval_T with NULL 17-- string works correctly. This test checks that unexistent environment 18-- variable produces NULL string, not that some specific environment 19-- variable does not exist. Last bit is left for the test writers. 20local unexistent_env ='XXX_UNEXISTENT_VAR_XXX' 21while os . getenv ( unexistent_env ) ~= nil do 22unexistent_env =unexistent_env .. '_XXX' 23end 24local rettv =eval0 ( '$' .. unexistent_env ) 25eq ( eval . VAR_STRING , rettv . v_type ) 26eq ( nil , rettv . vval . v_string ) 27end ) 28 29itp ( 'is produced by v:_null_list' , function () 30local rettv =eval0 ( 'v:_null_list' ) 31eq ( eval . VAR_LIST , rettv . v_type ) 32eq ( nil , rettv . vval . v_list ) 33end ) 34 35itp ( 'is produced by v:_null_dict' , function () 36local rettv =eval0 ( 'v:_null_dict' ) 37eq ( eval . VAR_DICT , rettv . v_type ) 38eq ( nil , rettv . vval . v_dict ) 39end ) 40end )