eval/encode: Make sure that encoder can encode NULL variables

Adds two undocumented v: variables: _null_list and _null_dict because I do not 
know a reproducible way to get such lists (though I think I heard about this) 
and dictionaries (do not remember hearing about them). NULL strings are obtained 
using $XXX_UNEXISTENT_VAR_XXX.

Fixes crash in json_encode($XXX_UNEXISTENT_VAR_XXX). Other added tests worked 
fine before this commit.
This commit is contained in:
ZyX
2016-04-04 04:53:07 +03:00
parent c4f1b5a938
commit bda0165514
7 changed files with 89 additions and 1 deletions

View File

@@ -379,6 +379,8 @@ static struct vimvar {
VV(VV_FALSE, "false", VAR_SPECIAL, VV_RO),
VV(VV_TRUE, "true", VAR_SPECIAL, VV_RO),
VV(VV_NULL, "null", VAR_SPECIAL, VV_RO),
VV(VV__NULL_LIST, "_null_list", VAR_LIST, VV_RO),
VV(VV__NULL_DICT, "_null_dict", VAR_DICT, VV_RO),
};
#undef VV